Implementing Flash Remoting

Example Script
class clSystemInformation extends mx.screens.Form
{
private var gateway:Object; // object to hold the connection
private var service:Service; // object to call the remote service

function clSystemInformation()
{
NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway"); //set where the CF service lies
gateway = NetServices.createGatewayConnection(); // create the remote connection
}

function someMethodThatUsesRemoting():Void
{
service = new Service("http://localhost/flashservices/", null, "Building.system.cfcomponents.flashBuilding", null, null); //decalre which CF module (aka class) you'll be using
var pc:PendingCall = service.saveSystemStructure(structureName, jobID, zoneID, systemID, systemParameters); // make the remote method all. Save System Structure is the CF method beinng called
pc.responder = new RelayResponder(this, "dataRetrieved", "dataRetrievedFault"); // declare which methods will handle the results of the remote call
}

function dataRetrieved(result:ResultEvent):Void // method invoked if call is successul
{
}

function dataRetrievedFault(fault:FaultEvent):Void // method invoked if call is a failure
{
}
}

<< Previous Page Table of Contents Next Page >>

Valid XHTML 1.0! Valid CSS!