Invoking Java Methods In Actionscript; Looking At A Flash Application That Calls A Javabean - 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

Invoking Java methods in ActionScript

After you have created a reference to a Java class or JavaBean, you can use ActionScript functions
to invoke that object's public methods. Consider the following JavaBean method:
public String getMessage() {
count++;
return message + " (count=" + count + ")";
}
You could use the following ActionScript code to invoke the
assuming
flashtestService
function getMsg():Void
{
var pc:PendingCall = flashtestService.getMessage();
pc.responder = new RelayResponder( this, "getMessage_Result",
"getMessage_Fault");
}
The second line creates a RelayResponder and assigns it to the responder property of the pc
PendingCall object. The RelayResponder identifies the methods that handle the result and fault
conditions. The first parameter,
returned to those methods in this object. If the result handling methods were contained in a
different object, you would specify the name of that object.
To handle the function results, you use a result handler function and a fault handler function like
the following:
function getMessage_Result( re:ResultEvent ):Void
{
messageOutput.text = re.result;
}
function getMessage_Fault( fe:FaultEvent ):Void
{
mx.remoting.debug.NetDebug.trace({level:"None", message:"There was a
problem" + fe.fault.faultstring});
}
For more information, see

Looking at a Flash application that calls a JavaBean

The following sections examine the three parts of an application that are required to call a
JavaBean from a Flash application that uses Flash Remoting:
"Looking at the JavaBean code" on page 124
"Looking at the user interface for the JavaBean" on page 125
"Looking at the ActionScript code that calls the JavaBean" on page 125
represents your reference to the JavaBean:
, specifies that the results of the service function call are
this
"Handling function results in ActionScript" on page
Calling Java classes or JavaBeans from ActionScript
method, for example,
getMessage()
137.
123

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?

This manual is also suitable for:

Flash remoting mx

Table of Contents