Using The Faultevent Class - MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Use Manual

Using flash remoting for flash mx 2004 actionscript 2.0
Table of Contents

Advertisement

Handling the result object requires knowledge of the service function. The service function could
return a simple string, as shown in the following
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
handling method for the call to the
set and binds the Name and ID fields of the records in the record set to the
ComboBox. In this case, the
the
DataGlue.bindFormatStrings()
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
,
faultstring
description
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
object and calls the
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.
46
Chapter 2: Using Flash Remoting ActionScript
custService.getCategories()
property (
result
function.
object (
fault
,
, and
detail
onCategoryFault()
method to display a description of the error (
NetDebug.trace()
).
HelloWorld_Result()
onCategoryData()
) holds the record set that is passed to
re.result
), which has
mx.rpc.Fault
properties. These properties contain information
type
fault handling function receives a FaultEvent
method:
method, which is the result
method, receives a record
custCat_cmbo
,
faultcode
fault.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash remoting mx

Table of Contents