
611
DEVELOPING
COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
Las
t
upda
te
d 8/5/2010
Using the Flash Remoting service with ColdFusion pages
When you build a ColdFusion page that interacts with a SWF application, the directory name that contains the
ColdFusion pages translates to the service name that you call in ActionScript. The individual ColdFusion page names
within that directory translate to service functions that you call in ActionScript.
Note:
Flash Remoting cannot interact with virtual directories accessed through a ColdFusion mapping.
In your ColdFusion pages, you use the Flash variable scope to access parameters passed to and from a SWF application.
To access parameters passed from a SWF application, you use the parameter name appended to the
Flash
scope or
the
Flash.Params
array. To return values to the SWF application, use the
Flash.Result
variable. To set an
increment value for records in a query object to be returned to the SWF application, use the
Flash.Pagesize
variable.
The following table shows the variables contained in the Flash scope:
The following table compares the ColdFusion data types and their ActionScript equivalents:
logger level
You can set the level of logging between
None
,
Error
,
Info
,
Warning
, and
Debug
. The
following tag is the default logger level tag:
<logger level="Error">coldfusion.flash.ColdFusionLogger</logger>
redirect URL
In the
<redirect-url>
tag, you can specify a URL to receive HTTP requests that are
not sent with AMF data. By default, the
<redirect-url>
tag is set to
{context.root}
, which is the context root of the web application:
<redirect-url>{context.root}</redirect-url>
case sensitivity
The <
lowercase-keys>
tag specifies how the gateway handles case sensitivity.
ActionScript 1.0 and ColdFusion use case insensitive data structures to store associative
arrays, objects and structs. The Java representation of these data types requires a case-
insensitive Map, which the gateway achieves by forcing all keys to lowercase.
ActionScript 2.0 is case sensitive and requires a <lowercase-keys> tag value of
false
.
The following
<lowercase-keys>
tag is the default tag:
<lowercase-keys>true</lowercase-keys>
Variable
Description
For more information
Flash.Params
Array that contains the parameters passed from the SWF application.
If you do not pass any parameters,
Flash.params
still exists, but it is
empty.
See “
Accessing parameters passed from
Flash
” on page
612.
Flash.Result
The variable returned from the ColdFusion page to the SWF
application that called the function.
Note:
Because ActionScript performs automatic type conversion, do
not return a Boolean literal to Flash from ColdFusion. Return
1
to
indicate
true
, and return
0
to indicate
false
.
See “
Returning results to Flash
” on page
613.
Flash.Pagesize
The number of records returned in each increment of a record set to a
SWF application.
See “
Returning records in increments to
Flash
” on page
614.
ActionScript data type
ColdFusion data type
Number (primitive data type)
Number
Boolean (primitive data type)
Boolean (0 or 1)
String (primitive data type)
String
Feature
Description