Using Flash With Coldfusion Components - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

To create a ColdFusion page that returns a incremental record set to Flash:
Create a ColdFusion page, and save it as getData.cfm in the helloExamples directory.
1
Modify getData.cfm so that the code appears as follows:
2
<cfparam name="pagesize" default="10">
<cfif IsDefined("Flash.Params")>
<cfset pagesize = Flash.Params[1]>
</cfif>
<cfquery name="myQuery" datasource="ExampleApps">
SELECT *
FROM tblParks
</cfquery>
<cfset Flash.Pagesize = pagesize>
<cfset Flash.Result = myQuery>
In this example, if a single parameter is passed from the Flash application, the
variable is set to the value of the
Next, a
cfquery
into the
Flash.Pagesize
Flash.Result
Save your work.
3
When you assign a value to the
has more than a certain number of records, the record set becomes pageable and returns the
number of records specified in the
include "NetServices.as"
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/
gateway");
gatewayConnection = NetServices.createGatewayConnection();
CFMService = gatewayConnection.getService("helloExamples", this);
CFMService.getData();
After the initial delivery of records, the RecordSet ActionScript class becomes responsible for
fetching records. You can configure the client-side RecordSet object to fetch records in various
ways using the
setDeliveryMode

Using Flash with ColdFusion components

ColdFusion components require little modification to work with Flash. The
names the function and contains the CFML logic, and the
Flash. The name of the ColdFusion component file (*.cfc) translates to the service name in
ActionScript.
Note: For ColdFusion component methods to communicate with Flash movies, you must set the
tag's
cffunction
The following example replicates the
ColdFusion page. For more information, see
pages" on page
643.
646
Chapter 29: Using the Flash Remoting Service
Flash.Params[1]
statement queries the database. After that, the
variable. Finally, the query results are assigned into the
variable, which is returned to Flash.
Flash.Pagesize
Flash.Pagesize
ActionScript function.
attribute to
access
remote
helloWorld
variable, otherwise the default is set to
variable, you are specifying that if the record set
. For example:
cfreturn
.
function that was previously implemented as a
"Using the Flash Remoting service with ColdFusion
pagesize
variable is assigned
pagesize
cffunction
tag returns the result to
.
10
tag

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

This manual is also suitable for:

Coldfusion mx

Table of Contents