Foo = function() { if(_global.NetServices == undefined) { trace("NetServices.as is required and must be included before Foo.as"); } } Foo.prototype.gatewayURL = "/flashservices/gateway"; Foo.prototype.firstName = null; Foo.prototype.lastName = null; Foo.prototype.setGatewayURL = function(url) { this.gatewayURL = url; } Foo.prototype.setFirstName = function(firstName) { this.firstName = firstname; } Foo.prototype.setLastName = function(firstName) { this.lastName = lastName; } Foo.prototype.createName = function() { var server = NetServices.createGatewayURL(this.gatewayURL); var service = server.getService("com.domain.test", this); service.createName(this.firstName, this.lastName); } Foo.prototype.createName_Result = function(data) { this.onName(data); } Foo.prototype.createName_Status = function(info) { if((typeof(this.onError) != "function")) { trace("Error : " + info.description); } this.onError(info); }