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

Handling results for a Connection object 167
Handling results for a Connection object
When you use the methods of the NetServices object to create a gateway connection and obtain a
Connection object, you use the
Connection.getService() method to access a service. When
you access a service using the methods of the Connection object, you can either direct all results
for a service to a single object or direct the results of a specific service call to a specific result
handler.
Note: Do not specify a responder object in the gatewayConnection.getService() method and in the
service function call. If you specify the responder in both places, Flash Remoting passes the
responder you specify as an argument to the service function. This behavior causes errors in your
application.
When you test an application in Flash during development, if there is no appropriate responder
object method, Flash displays the results in a message window.
Directing all results for a service to a single responder object
You can direct all results for a service to a single result handler by specifying a responder object as
the second argument of the
getService() method call. The following example uses the
Connection.getService() method to access the remoteservices service and specifies
HelloResponder as the responder object to receive the results.
howdyService=gatewayConnection.getService("remoteservices",
new HelloResponder()); // responder
You can direct results to a specific method in the result handler by providing a method with the
name
serviceFunctionName_Result(), where serviceFunctionName is the name of the
service method.
Any results that are not directed to a specific result handler method are directed to the
onResult() method.
Use this technique if all the following conditions are true:
• The results of calls to one function name must be handled differently from the results of calls
to another function.
• All functions in all services that require different handling have unique names. For example,
you do not use two services with identically named functions, such as
myFirstService.myFunction and myOtherService.myFunction, that require different
processing.
• The results of all calls to a particular function in a service can be handled by a single responder.
The following example shows how you can use the main SWF file as the responder and have a
common
onResult() method result handler for some service functions, and function-specific
functionName_Result handlers for other functions. In this example, there are two function-
specific result handlers, the
helloWorld_Result() and the whatsUp_Result() method, which
display the returned message in specific text boxes. The default
onResult() response handler
displays the result in the Output panel.
import mx.remoting.NetServices;
import mx.remoting.Connection;