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

Creating a gateway connection using the NetServices object 165
Setting a default gateway URL provides you with the greatest flexibility in both development and
deployment. It lets you provide a URL that works when you test your SWF file directly in the
Flash development environment. Setting a gateway URL also lets you override the default value
with a server-specific gateway that you specify in the web page when you deploy your SWF file.
Note: If you specify localhost as the host in the setDefaultGatewayUrl() method, and you run your
Flash application from outside the Flash development environment or Macromedia Flash Player,
Flash Remoting does not use localhost as the default gateway host. Instead, it replaces
localhost
and any port specified in the
setDefaultGatewayUrl() method with the host and port specified to run
the Flash application. For example, if you specify http://localhost/flashservices/gateway in the
setDefaultGatewayUrl() method and start your Flash application by using the URL http://
apps.mycompany.com:8500/flashapps/myapp.swf in a web page or browser, Flash Remoting uses
http://apps.mycompany.com:8500/flashservices/gateway as the gateway URL.
Authenticating a user to the application server
In some cases, your application server might require you to provide user authentication—a user
name and password—before you can use a service.
Flash Remoting provides the
setCredentials() method of the Connection class to allow you to
specify authentication credentials to send to the application server. Flash Remoting sends the
credentials in the header of every service function call. This method is currently supported on the
following servers:
• ColdFusion MX
• JRun 4
If you created the gateway object using the NetServices class, you can call the
setCredentials()
method to provide authentication, as follows:
import mx.remoting.NetServices;
// set the default gateway URL
NetServices.setDefaultGatewayUrl("http://www.mySite.com/flashservices/
gateway");
// connect to the gateway
gatewayConnection = NetServices.createGatewayConnection();
// authenticate the user
gatewayConnection.setCredentials(username, password)
// create a service object for myService
serviceObject = gatewayConnection.getService("myService", this);
Note: To ensure security, never include specific user names or passwords in ActionScript.
Flash supplies the login credentials with each service request; therefore, your ActionScript should
log the user out of the application server and reset the credentials when the user logs out of your
Flash application.
To log out the user and reset the credentials:
1.
Call a logout service method on the server that logs out the user.
For example, for ColdFusion, call a method that uses the
cflogout tag.
2.
Set the gateway connection credential information to empty strings.