User Guide

Table Of Contents
Using Flash with CFCs 817
When you assign a value to the Flash.Pagesize variable, you are specifying that if the record set
has more than a certain number of records, the record set becomes pageable and returns the
number of records specified in the
Flash.Pagesize variable. For example, the following code
calls the
getData() function of the CFMService and uses the first parameter to request a page
size of 5:
import mx.remoting.*;
import mx.services.Log;
import mx.rpc.*;
// Connect to helloExamples service and create the CFMService service object
var CFMService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"helloExamples",
null,
null );
// Call the service getData() method
var pc:PendingCall = CFMService.getData(5);
// Tell the service what methods handle result and fault conditions
pc.responder = new RelayResponder( this, "getData_Result", "getData_Fault" );
function getData_Result(re:ResultEvent)
{
// Display successful result
DataGlue.bindFormatStrings(employeeData, re.result, "#PARKNAME#, #CITY#,
#STATE#");
}
function getData_Fault(fe:FaultEvent)
{
// Display fault returned from service
trace("Error description from server: " + fe.fault.description);
}
In this example, employeeData is a Flash list box. The result handler, getData_Result, displays
the columns PARKNAME, CITY, and STATE in the
employeeData list box. After the initial
delivery of records, the RecordSet ActionScript class assumes the task of fetching records. In this
case, the list box requests more records as the user scrolls the list box.
You can configure the client-side RecordSet object to fetch records in various ways using the
ResordSet.setDeliveryMode ActionScript function.
Using Flash with CFCs
CFCs require little modification to work with a Flash application. The cffunction tag names
the method and contains the CFML logic, the
cfargument tag names the arguments, and the
cfreturn tag returns the result to the Flash application. The name of the CFC file (*.cfc)
translates to the service name in ActionScript.
Note: For CFC methods to communicate with Flash applications, you must set the cffunction tag’s
access attribute to remote.