Getting A Reference To A Server-Side Actionscript File; Invoking Server-Side Actionscript Functions - 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

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:
Import the Flash Remoting files:
1.
import mx.remoting.Service;
Connect to the Flash Remoting gateway and get a reference to the server-side ActionScript file:
2.
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
The third parameter of the
ASR file relative to a web application context root. In this example,
of the web application,
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,
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;
}
136
Chapter 7: Using Flash Remoting for Java
constructor is the directory structure and name of the
Service
is a directory under the context root, and
script
29.
is the context root
flash
FlashSample
flashssasService
is the
represents

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