View comments | RSS feed

Converting from application server data types to ActionScript

Flash Remoting MX automatically converts between the data types specific to the application server programming environment and ActionScript.

The following table shows how Flash Remoting MX converts data returned from the application server to ActionScript data types:
C#
Visual Basic
SOAP
ColdFusion MX
Java
ActionScript
null
Nothing
null
N/A
null
null
bool
System.Boolean
Boolean
boolean
Boolean, 0, or 1
For details, see "Boolean data in ColdFusion"
Boolean
Boolean
any number type
any number type
decimal, float, double
Val(Number)
For details, see "Numeric data in ColdFusion"
Number
Number
System.Char
System.String
Char
String
string
String
String
Character
String
See "Server data conversion notes"
System.DateTime
Date
dateTime
Date
Date
Date
System.Collections.ICollection
object[]
System.Collections.ICollection
object[]
array
Array
Collection
Object[]
array of primitive types
Array
System.Collections.Hashtable
System.Collections.IDictionary
System.Collections.Hashtable
System.Collections.IDictionary
complex type
Struct
java.util.Map
Associative array
Sytem.Data.
DataSet
Sytem.Data.
DataSet
Complex type (DataSet)
-
-
Associative array of RecordSet objects
System.Data.Data
Table
System.Data.Data
Table
-
Query object
java.sql.Result
Set
RecordSet
-
-
-
Query object
(Flash.pagesize variable set)
flashgateway.
sql.Pageable
ResultSet
Paged RecordSet
FlashGateway.IO.
ASObject
System.Exception
FlashGateway.IO.
ASObject
System.Exception
Complex type
A Java object as listed in the next column
flashgateway.io.
ASObject
Serializable
Dictionary
Throwable
Object
FlashGateway.IO.
ASObject with Type property set
FlashGateway.IO.
ASObject with Type property set
Complex type
Java Object of class flashgateway.io.
ASObject with Type property set
(Set the type using a Java expression once you create the object using CFML.)
flashgateway.io.
ASObject with Type property set
Typed Object
See "Server data conversion notes"
System.Xml.
XmlDocument
System.Xml.
XmlDocument
-
XML
org.w3c.dom.
Document
flashgateway.io.ASXMLString
XML

Server data conversion notes

The following is additional information on conversion from server data types to ActionScript data types:

ColdFusion to ActionScript data conversion issues

ColdFusion is a loosely typed or "untyped" language, where the data type of a variable can be ambiguous. As a result, Flash Remoting MX cannot always determine how to convert between ColdFusion data and ActionScript data. The following sections discuss the limitations that this situation imposes, and how to prevent errors that can arise as a result.

Boolean data in ColdFusion

If a ColdFusion page or CFC returns Boolean values, it represents these values as strings. Flash does not have rules for converting strings to Boolean values. Instead, it converts the string to a number, and then converts the number to a Boolean value. This operation converts all representations of Boolean values to False. Therefore Flash converts ColdFusion Boolean values of "Yes", "True", and True to False.

To return a Boolean value correctly from ColdFusion to ActionScript, do either of the following:

Numeric data in ColdFusion

If a ColdFusion page or CFC returns a numeric value without specifically identifying the value as numeric, Flash Remoting MX 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:

If you call either of these getNumber functions from Flash, the ActionScript getNumber_Result function displays the value 4.

Comments


sgilson102 said on Sep 30, 2002 at 5:09 PM :
The type java.sql.ResultSet is not supported for this release of Flash Remoting.

Stephen M. Gilson
Flash Remoting Documentation

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flashremoting/mx/Using_Flash_Remoting_MX/UseASData4.htm