User Guide
Table Of Contents
- Contents
- About Flash Remoting
- Getting Started
- Using Flash Remoting ActionScript
- Using the RemotingConnector component (Flash Professional only)
- Using Flash Remoting Data in ActionScript
- About Flash Remoting and data types
- Understanding Action Message Format
- Converting from ActionScript to application server data types
- Converting from application server data types to ActionScript
- ColdFusion to ActionScript data conversion issues
- About working with objects
- About working with RecordSet objects
- About working with XML
- The NetConnection Debugger
- Using Flash Remoting with ColdFusion MX
- Using Flash Remoting for Java
- About Flash Remoting for Java
- Calling Java classes or JavaBeans from ActionScript
- Calling Enterprise JavaBeans (EJBs) from Flash
- Calling servlets and JSPs from Flash
- Calling JMX MBeans from Flash (JRun only)
- Calling server-side ActionScript from Flash (JRun only)
- Handling function results in ActionScript
- Using Flash Remoting with JRun security
- Passing XML objects between Flash and Java
- Viewing Flash Remoting log entries
- Using Flash Remoting for Microsoft .NET
- Flash Remoting for Microsoft .NET
- Calling ASP.NET pages from Flash
- Making an ASP.NET page available to Flash Remoting
- Getting a reference to an ASPX-based service in ActionScript
- Invoking ASPX pages in ActionScript
- Using the Flash Remoting custom server control in ASPX pages
- Using the Flash Remoting namespace in code-behind files
- Using ASP.NET state management with Flash Remoting
- Using ASP.NET exception handling
- Using ADO.NET objects with Flash Remoting
- Displaying a RecordSet object in Flash with ActionScript
- Calling web services from Flash
- Calling ASP.NET assemblies from Flash
- Viewing Flash Remoting log entries
- Using NetServices and Connection Classes
- Index

164 Appendix A: Using NetServices and Connection Classes
You can also combine these techniques. If you do so, the gateway URL is determined as follows:
1.
A URL specified in a createGatewayConnection() method takes precedence over any
other URL.
2.
A URL specified in the deployed web page takes precedence over a default gateway URL.
3.
If you do not otherwise specify a gateway URL, Flash Remoting uses the gateway specified in a
NetServices.setDefaultGatewayUrl() method.
Macromedia recommends using the
setDefaultGatewayUrl() method to specify the URL of
the gateway that you use in the Flash authoring environment. Doing so lets you test your Flash
Remoting application directly in the development environment, without having to change your
code when you deploy your application. When you deploy the SWF file, supply the production
gateway URL in the web page that you use to run the Flash application. This way, you also do not
have to make any changes in your Flash application to deploy the SWF file on different
application servers.
Specifying the gateway in the NetServices createGatewayConnection()
method
You use the
createGatewayConnection() method to configure a connection to a specific
gateway. For example:
import mx.remoting.Connection;
import mx.remoting.NetServices;
// farther in the application . . .
var gatewayConnection:Connection = NetServices.createGatewayConnection("http:/
/apps.mycompany.com/flashservices/gateway");
The gatewayConnection object returned by this method is the Connection object for the
connection. You can use this object to set security credentials, if required, and to access the Flash
Remoting service or services that you will use.
This technique has the disadvantage of using a hard-coded URL. To change it, you must change
the ActionScript, and publish and deploy your SWF file.
Using the NetServices setDefaultGatewayUrl() method
The
setDefaultGatewayUrl() method sets a default value for the gateway URL, which the
createGatewayConnection() method uses if you do not supply the Flash Remoting service
URL. For example:
import mx.remoting.NetServices;
import mx.remoting.Connection;
NetServices.setDefaultGatewayUrl("http://apps.mycompany.com/flashservices/
gateway");
var gatewayConnection:Connection = NetServices.createGatewayConnection();
Because you set a default gateway URL, you do not always need to specify the gateway URL
elsewhere. However, you can override the default value by specifying a gateway URL in the
createGatewayConnection() method or in the web page that calls your SWF file.