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

Developing coldfusion mx applications
Table of Contents

Advertisement

Accessing parameters passed from Flash
To access variables passed from Flash movies, you append the parameter name to the Flash scope
or use the
Flash.Params
to array values using ordered array syntax or structure name syntax. Only ActionScript objects can
pass named parameters.
For example, if you pass the parameters as an ordered array from Flash
first value. If you pass the parameters as named parameters, you use standard structure-name
syntax like
params.name
You can use most of the CFML array and structure functions on ActionScript collections.
However, the StructCopy CFML function does not work with ActionScript collections. The
following table describes the collections and examples:
Collection
Strict array
Named or
associative array
Mixed array
Using an
ActionScript
object initializer
for named
arguments
The
Flash.Params
You use standard structure name syntax to reference the parameters; for example:
<cfquery name="flashQuery" datasource="exampleapps" dbtype="ODBC">
SELECT ItemName, ItemDescription, ItemCost
FROM tblItems
WHERE ItemName EQ '#Flash.paramName#'
</cfquery>
644
Chapter 29: Using the Flash Remoting Service
array. Depending on how the values were passed from Flash, you refer
.
ActionScript example
var myArray = new Array();
myArray[1] = "one";
myArray[2] = "two";
myService.myMethod(myArray);
var myStruct = new Array();
myStruct["one"] = "banana";
myStruct["two"] = "orange";
var myMixedArray = new Array();
myMixedArray["one"] = 1;
myMixedArray[2] = true;
myService.myMethod
({ x:1, Y:2, z:3 });
array retains the order of the parameters as they were passed to the function.
, array[1]
Notes
The Flash Remoting service converts the
array argument to a ColdFusion MX array.
All CFML array operations work as
expected.
In ActionScript, named array keys are not
case-sensitive.
Treat this collection like a structure in
ColdFusion MX. However, keys that start
with numbers are invalid CFML variable
names. Depending on how you attempt to
retrieve this data, ColdFusion MX might
throw an exception. The following
ColdFusion component example throws
an exception:
<cfargument name="ca" type="struct">
<cfreturn ca.2>
The following ColdFusion component
example does not throw an exception:
<cfargument name="ca" type="struct">
<cfreturn ca["2"]>
This notation provides a convenient way
of passing named arguments to a
ColdFusion MX-based Flash Remoting
service. You can access these arguments
in ColdFusion pages as members of the
Flash scope, or as normal named
arguments of a ColdFusion component
function
references the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents