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 function results in ActionScript 137
For more information, see the next section.
Handling function results in ActionScript
In Java application servers, you handle function results in ActionScript the same way that you do
for other platforms that Flash Remoting supports. You write an ActionScript result handler
function and tell the RelayResponder object its name. For example, to pass the return value of the
following ActionScript function to ActionScript:
function calculate()
{
loanService.calculate( (number (principalInput.text)), (number
(monthsInput.text)), (number (rateInput.text)) );
}
You would use the following ActionScript function:
function calculate_Result(re:mx.rpc.ResultEvent)
{
payOutput.text = re.result;
}
If a method returns an object that implements the Java Serializable interface, and all of its fields
are serializable, its public and private properties are available as ActionScript properties. For
example, the following method in a Java class called Loan calculates loan payments and returns an
instance of a JavaBean called
LoanInfo that stores values for the principal, months, rate, and
monthlyPayment properties:
public LoanInfo calculateReturnComplex(double principal, int months, float
rate){
if (rate < 0 || rate>1)
principal = 0.0;
double monthlyPayment = principal * (rate / (1 - Math.pow(1 +
rate,-months)));
LoanInfo info=new LoanInfo(principal, months, rate, monthlyPayment);
return info;
}
You could use the following calculate() function to call this method in ActionScript:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.Result.Event;
mx.remoting.debug.NetDebug.initialize();
//…
function calculate()
{
pc:PendingCall = loanService.calculateReturnComplex( (number
(principalInput.text)), (number (monthsInput.text)), (number
(rateInput.text)) );
pc.responder = new RelayResponder(this, "calculateReturnComplex_Result",
"calculateReturnComplex_Fault");
}