If a ColdFusion page or CFC returns a numeric value without specifically identifying the value as
numeric, Flash Remoting treats the value as a string when passing it to the responder. For
example, if you have the following user-defined function and ActionScript code, Flash displays
22, not 4, in the trace message:
ColdFusion
<cffunction name="getNumber"access="remote">
<cfreturn 2>
</cffunction>
ActionScript
function getNumber_Result (result)
{
myVar = (result + 2);
trace (myVar);
}
To prevent such problems, do either of the following:
•
Specify the
returnType="numeric"
example:
<cffunction name="getNumber" access="remote" returnType="numeric">
<cfset foo = 2>
<cfreturn foo>
</cffunction>
•
Use the
function to explicitly convert the value to a number before you return it, as in the
Val
following example:
<cffunction name="getNumber" access="remote">
<cfset foo = Val(2)>
<cfreturn foo>
</cffunction>
If you call either of these
getNumber_Result()
About working with objects
When you pass a Flash object in a service function call, the object's properties are sent to the
gateway. In Java environments, an instance of the
implements java.util.Map) represents a Flash object. In .NET environments, an instance of the
FlashGateway.IO.ASObject
Flash object. Therefore, you can pass Flash objects to any service function that accepts a Map or
ICollection argument.
Because Flash Remoting transmits data only, the object methods are not available on the server.
Similarly, the object properties must be data types that Flash Remoting can handle. For example,
you cannot include a Flash RecordSet object in an object that you pass to a service function,
because Flash Remoting cannot convert the RecordSet object to a data type on the server.
70
Chapter 4: Using Flash Remoting Data in ActionScript
attribute in the
functions from Flash, the ActionScript
getNumber()
function in the previous example displays the value 4.
class (which implements the ICollection interface) represents a
tag, as in the following
cffunction
flashgateway.io.ASObject
class (which
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?