Macromedia flash remoting mx-using flash remoting for flash mx 2004 actionscript 2.0 Manuel D’Utilisation

Page de 180
98
Chapter 6:  Using Flash Remoting with ColdFusion MX
For example, suppose you create a ColdFusion page named helloWorld.cfm in the directory 
helloExamples under your web root (web_root/helloExamples). You can then use the following 
ActionScript in your Flash application to call helloWorld.cfm:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
//…
var CFMService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"helloExamples",
null,
null);
var pc:PendingCall = CFMService.helloWorld();
pc.responder = new RelayRsponder(this, "helloWorld_Result", 
"helloWorld_Fault");
//…
To specify subdirectories of the web root directory or a virtual directory, use package dot notation. 
If helloWorld.cfm is in the directory web_root/helloExamples/ColdFusion, you can use the 
following ActionScript to create the service:
import mx.remoting.Service;
//
var CFMService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"helloExamples.ColdFusion",
null,
null);
Remember to use periods to delimit directory names for the 
new Service()
 constructor. 
Using the Flash scope to pass parameters to ColdFusion pages
ColdFusion MX defines an application scope called Flash that you use to access parameters passed 
from Flash applications and return values to Flash applications. The application scope associates 
variables with one, named application on a server.