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

Building Flash applications with Flash Remoting 17
Using Flash Remoting
Like a web browser request for an HTML page, a Flash application that uses Flash Remoting
connects to a remote service and makes a service function call. The service function call is a
client-initiated event. The Flash application makes a request to the remote service; the service
processes the request and returns the results.
It is important to note that the Flash application does not wait for the result; it handles the result
when the service function returns it. The Flash application makes requests from ActionScript to
the server and receives results asynchronously.
This means that the ActionScript code that immediately follows the service request executes
before the result of the call is returned from the server. The following example illustrates this
principle by invoking the
trace() function immediately after the service request and then again
when the result is returned by the server.
import mx.remoting.Service; // import Service class
import mx.rpc.FaultEvent; // import FaultEvent class
import mx.remoting.PendingCall // import PendingCall clsas
import mx.rpc.ResultEvent // import ResultEvent class
import mx.rpc.RelayResponder // import RelayResponder class
mx.remoting.debug.NetDebug.initialize();
var myService:Service = new Service("http://examples.macromedia.com/
flashservices/gateway",null,"petmarket.api.catalogservice",
null, null); // connect to remote service
var pc:PendingCall = myService.getCatagories({locale:”en_US”}); // call
service method
pc.responder = new RelayResponder(this, "getData_Result", "getData_Fault");
trace( "no response from server yet." );
function getData_Result( re:ResultEvent ):Void { // receive result
trace( "got the response" );
}
function getData_Fault( fe:FaultEvent ):Void { // receive fault
trace( "got the response" );
}
The output from these calls to the trace() function would appear in the following order:
no response from server yet
got the response
Notice that the first call to the trace() function executes before the result is returned from
the service.
For more information on how to receive and process asynchronous messages from Flash
Remoting, see “Handling service results and errors” on page 43.