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

Calling Java classes or JavaBeans from ActionScript 123
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 getMessage() method, for example,
assuming
flashtestService represents your reference to the JavaBean:
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,
this, specifies that the results of the service function call are
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 “Handling function results in ActionScript” on page 137.
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