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 service results and errors 43
Note: Calling web services using Flash Remoting is supported only in Flash Remoting for ASP.Net
and in the Flash Remoting support included with ColdFusion MX. Flash Remoting for Java and the
Flash Remoting support in JRun do not support calling web services using Flash Remoting.
Calling functions using named arguments in ColdFusion
If you are calling a ColdFusion page or ColdFusion component that can take named arguments,
you can also call a service function and pass it a single ActionScript object that contains
name-value pairs for the arguments, as shown in the following example:
myService.myFunction({dept: "Sales", name: "BobZ"});
The ColdFusion page or component uses the object elements, dept and name, as named
arguments. For more information, see “Passing parameters to ColdFusion components”
on page 106.
Handling service results and errors
When you call a service function, there are two possible outcomes: the result that you expect or a
fault (error). These outcomes are relayed to a result handler method and an error handler method,
respectively, which you specify. For example, a result handler could display the results in the Flash
application, while an error handler might call trace functions to report the error descriptions. You
can specify the result and fault handling methods either for all results and faults that occur for the
service or for specific server function calls.
In both cases, you specify a responder object. The responder object can be any ActionScript
object that implments the mx.rpc.Responder interface. The Responder interface exposes two
methods (
onResult() and onFault()) that respond to the results and faults for the current
pending call. For convenience Flash Remoting API provides an implementation of the mx.rpc.
Responder interface that you can use: mx.rpc.RelayResponder.
The RelayResponder relays any result and fault responses to any object and any method of that
object. To specify the methods that handle the result and the fault conditions, the constructor for
the RelayResponder object has, as its second and third parameters, the names of the methods that
handle the ResultEvent and FaultEvent objects that the service method returns. The first
parameter specifies the name of the object that contains these methods. For example, the
RelayResponder in the HelloWorld example specifies that the result handling method is
helloWorld_Result(), the fault handling method is helloWorld_Fault(), and the class that
contains them is this class (this).
pc.responder = new RelayResponder( this, "helloWorld_Result",
"helloWorld_Fault" );
Note: Do not specify result handler and fault handler methods when you create the service object and
when you call a service function. Specifying methods in both places can cause errors in your
application that might be difficult to diagnose.
ColdFusion pages (.cfm) ColdFusion page (without the cfm suffix)
ColdFusion components (.cfc) Component method
Service type Function name