You access
and
x
as follows:
<cfset arrayElement1=Flash.x[1]>
<cfset arrayElement2=Flash.x[2]>
<cfset structElement1=Flash.y.zero>
<cfset structElement2=Flash.y.one>
You can pass ActionScript objects to ColdFusion pages. The following ActionScript defines
an object:
var myObj:Object = new Object();
myObj.x = "one";
myService.myMethod(myObj);
In ColdFusion, you access the object elements using named parameters in the Flash scope,
as follows:
<cfset p1=Flash.x>
Returning results to ActionScript
In ColdFusion pages, only the value of the
application. Although you are limited to returning a single variable to the Flash application, that
variable can contain a single value, an array, a structure, or a record set returned from a
ColdFusion query.
For more information about converting data types between ColdFusion and Flash, see
"Using Flash Remoting Data in ActionScript," on page
The following procedure creates the service function helloWorld, which returns a structure that
contains simple messages to the Flash application.
To create a ColdFusion page that returns a structure:
Create a folder in a directory accessible to ColdFusion and your web server, and name it
1.
helloExamples. This directory can go under your web root directory.
Create a ColdFusion page, and save it as helloWorld.cfm in the helloExamples directory.
2.
Edit the helloWorld.cfm page to insert the following code:
3.
<cfset tempStruct = StructNew()>
<cfset tempStruct.timeVar = DateFormat(Now ())>
<cfset tempStruct.helloMessage = "Hello World">
<cfset Flash.Result = tempStruct>
In the example, you add two string variables to a structure, one with a formatted date and one
with a simple message. The structure is returned to the Flash application using the
Flash.Result
Save the file.
4.
102
Chapter 6: Using Flash Remoting with ColdFusion MX
in your ColdFusion page using ColdFusion array and structure notation,
y
variable.
variable is returned to the Flash
Flash.Result
63.
Chapter 4,
Need help?
Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?
Questions and answers