You want to handle typed objects using a J2EE service function.
Use JavaBean classes that correspond to the ActionScript classes, and
use the third-party
ASTranslator class to
perform conversions between datatypes.
Unlike the .NET version, Flash Remoting for J2EE does not
automatically convert typed ActionScript objects into corresponding
custom Java types. Instead, the gateway converts the ActionScript
ASObject types. The
flashgateway.io.ASObject class (included in
flashgateway.jar) is a subclass of
java.util.HashMap to which two additional
getType( ) and
)) have been added. The properties of the ActionScript
object are stored as key/value pairs in the
ASObject. You can create your own proprietary
code to convert between an
ASObject and the
appropriate Java datatype. However, Carbon Five has already created
an excellent utility named ASTranslator to do this for you.
ASTranslator is freely available for download from http://www.carbonfive.com/opensource-main-1.html.
It converts between
ASObject and custom Java
datatypes using JavaBean-style introspection. Therefore, it requires
that your custom Java datatypes adhere to the JavaBean rules (namely,
they must implement
get/set methods for all publicly accessible properties, and have a
constructor that requires no parameters).
Here is how to use ASTranslator to receive typed objects and convert them to custom Java ...