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

46 Chapter 2: Using Flash Remoting ActionScript
Handling the result object requires knowledge of the service function. The service function could
return a simple string, as shown in the following
HelloWorld_Result() method:
function serviceFunctionName_Result(result:ResultEvent)
{
// display successful result
messageDisplay.text = result.result;
}
The service function could also return a complex object such as a record set holding several
records that were retrieved from a database. The
onCategoryData() method, which is the result
handling method for the call to the
custService.getCategories() method, receives a record
set and binds the Name and ID fields of the records in the record set to the
custCat_cmbo
ComboBox. In this case, the
result property (re.result) holds the record set that is passed to
the
DataGlue.bindFormatStrings() function.
function onCategoryData( re:ResultEvent ):Void {
mx.remoting.debug.NetDebug.trace({level:"Debug",
message:"onCategoryData" });
// use data glue to remap the fields so that label = name field and
// data = id field
DataGlue.bindFormatStrings( custCat_cmbo, re.result, "#Name#", "#ID#" );
custCat_cmbo.addEventListener( "change", onCustCat_Change );
refreshCustomerData();
}
For more information about the ResultEvent class, see the ResultEvent class in Flash Remoting
ActionScript Dictionary Help.
Using the FaultEvent class
If a call to a service function results in an error, Flash Remoting returns a FaultEvent object as an
argument to the fault handling method that you specified in the RelayResponder object. The
FaultEvent object contains a
fault object (mx.rpc.Fault), which has faultcode,
faultstring, description, detail, and type properties. These properties contain information
about the error that occurred including a code, descriptions, a stack trace, and the error class
name. You can display this information to the application user in order to document the error. In
the following example, the
onCategoryFault() fault handling function receives a FaultEvent
object and calls the
NetDebug.trace() method to display a description of the error (fault.
fault.faultstring
).
function onCategoryFault( fault:FaultEvent ):Void {
// notify the user of the problem
mx.remoting.debug.NetDebug.trace({level:"None",
message:"There was a problem: " + fault.fault.faultstring });
}
For more information about the FaultEvent object, see the FaultEvent class in Flash Remoting
ActionScript Dictionary Help.