User Guide

Table Of Contents
163
APPENDIX A
Using NetServices and Connection Classes
This appendix explains how to use the NetServices object to create a gateway connection and
return a Connection object. It also explains how to handle results and error information that are
returned by a service. This appendix covers the following topics:
“Creating a gateway connection using the NetServices object” on page 163
“Handling results for a Connection object” on page 167
“Handling errors for a Connection object” on page 169
Creating a gateway connection using the NetServices object
Note: Although using NetServices to create a Connection object is still supported, in Macromedia
Flash MX 2004, Macromedia recommends that you create a gateway connection using the Service
object. For more information, see the Service class in Flash Remoting ActionScript Dictionary Help.
To create a Flash Remoting Connection object, you first specify the gateway URL and then create
a Connection object that uses it. You have several options for accomplishing these operations,
including the following:
You can use the NetServices.createGatewayConnection() method to specify the URL and
create the Connection object.
You can use a NetServices.setDefaultGatewayUrl() method to specify a default gateway,
and use the
NetServices.createGatewayConnection() method without a URL to create
the Connection object. Flash Remoting uses the default gateway for all connections that you
create without otherwise specifying a gateway.
You can specify the gateway in the web page you use to deploy the Flash SWF file, and use the
NetServices.createGatewayConnection() method without a URL to create the
Connection object.