Java Datatype Conversion

Java, unlike ActionScript 1.0, is a typed language. The Flash gateway on the server takes care of the datatype conversions back and forth between the Flash client and the Java server. Table A-3 shows the conversion from Flash ActionScript to Java. Refer also to the ASTranslator library, as discussed in Chapter 7. Chapter 7 also discusses intimate details of datatype conversion from ActionScript to Java and vice versa.

Table A-3. Flash-to-Java datatype conversion

Flash (ActionScript)

Java

ActionScript object

flashgateway.IO.ASObject (implements java.util.map)

Array (indexed)

ArrayList

Array (associative)

java.util.map

Boolean

Boolean

Date Object

Date

Number

Number

RecordSet

-

String

String

Undefined

Null

XML Object

org.w3c.dom document

Null

Null

Table A-4 shows the conversion from Java to Flash ActionScript.

Table A-4. Java-to-Flash datatype conversion

Java

Flash (ActionScript)

Struct

Associative array

Java object (flashgateway.IO.ASObject)

ActionScript object

Java object (flashgateway.IO.ASObject with type property set)

ActionScript object of that type

Collection, Object[], array of primitive types

Array (indexed)

java.util.map

Array (associative)

Boolean

Boolean

Date

Date object

Number

Number

disconnected RowSet[2]

RecordSet

flashgateway.sql.PageableResultSet[2]

pageable RecordSet

String

String

org.w3c.dom document

XML object

flashgateway.io.ASXMLString

XML object

Null

Null

[2] Only with Flash Remoting ...

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.