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

136 Chapter 7: Using Flash Remoting for Java
Getting a reference to a server-side ActionScript file
Before calling the functions of a server-side ActionScript file (with the .asr extension), you must
get a reference to the file. Place the server-side ActionScript file that you want to call in a web
application.
To get a reference to a server-side ActionScript file:
1.
Import the Flash Remoting files:
import mx.remoting.Service;
2.
Connect to the Flash Remoting gateway and get a reference to the server-side ActionScript file:
flashasService = new Service(
"http://localhost/flashservices/gateway"),
null,
"flash.script.FlashSample",
null,
null)
Note: There are several other ways to specify the gateway URL. For more information, see
Chapter 2, “Using Flash Remoting ActionScript,” on page 29.
The third parameter of the Service constructor is the directory structure and name of the
ASR file relative to a web application context root. In this example,
flash is the context root
of the web application,
script is a directory under the context root, and FlashSample is the
prefix of the ASR filename.
Invoking server-side ActionScript functions
After you have a reference to a server-side ActionScript file, you can use client-side ActionScript
functions to call its functions. For example, to call the following server-side ActionScript
function:
function getBiggerString(value)
{
return "Hello from SSAS " + value;
}
You could use the following client-side ActionScript code. Here, flashssasService represents
your reference to the server-side ActionScript file.
function getBiggerString()
{
pc:mx.remoting.PendingCall = flashsasService.getBiggerString(
stringInput.text );
pc.responder = new mx.rpc.RelayResponder(this, "getBiggerString_Result",
"getBiggerString_Fault");
}
To handle the function results, you use a result handler function like the following:
function getBiggerString_Result( re:mx.rpc.ResultEvent ):Void
{
stringOutput.text = re.result;
}