MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 645

Developing coldfusion mx applications
Table of Contents

Advertisement

In this example, the query results are filtered by the value of
the first parameter in the array. If the parameters were passed as an ordered array from Flash, you
use standard structure name syntax; for example:
<cfset flash.result = "Variable 1:#Flash.params[1]#, Variable 2:
#Flash.params[2]#">
In this ActionScript example, notice that ActionScript starts the array index at zero. ColdFusion
array indexes start at one.
Returning results to Flash
In ColdFusion pages, only the value of
application. For more information about supported data types between ColdFusion and Flash, see
the data type table in
The following procedure creates the service function
containing simple messages to the Flash application.
To create a ColdFusion page that passes a structure to Flash:
Create a folder in your web root, and name it helloExamples.
1
Create a ColdFusion page, and save it as helloWorld.cfm in the helloExamples directory.
2
Modify helloWorld.cfm so that the CFML code appears as follows:
3
<cfset tempStruct = StructNew()>
<cfset tempStruct.timeVar = DateFormat(Now ())>
<cfset tempStruct.helloMessage = "Hello World">
In the example, two string variables are added to a structure, one with a formatted date and one
4
with a simple message. The structure is passed back to the Flash application using the
variable.
Save the file.
5
Remember, the directory name is used the service address, and the helloWorld.cfm file is a
method of the
helloExamples
the helloWorld ColdFusion page:
include "NetServices.as"
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/
gateway");
gatewayConnection = NetServices.createGatewayConnection();
CFMService = gatewayConnection.getService("helloExamples", this);
CFMService.helloWorld();
Note: Due to ActionScript's automatic type conversion, do not return a boolean literal to Flash from
ColdFusion. Return 1 to indicate true, and return 0 to indicate false.
Returning records in increments to Flash
ColdFusion lets you return record set results to Flash in increments. For example, if a query
returns 20 records, you can set the
Flash. Incremental record sets lets you minimize the time that Flash application waits for the
application server data to load.
Flash.Result
"Using the Flash Remoting service with ColdFusion pages" on page
Flash Remoting service. The following ActionScript example calls
Flash.Pagesize
Using the Flash Remoting service with ColdFusion pages
Flash.paramName
variable is returned to the Flash
, which returns a structure
helloWorld
variable to return five records at a time to
, which references
643.
Flash.Result
645

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents