AS3 array to Java array Flash Remoting bug
I just stumbled across a very odd bug while using Flash remoting to pass AS3 data objects to Java. For each AS3 data object I have a corresponding Java data object, the two are carbon copies of each other and are mapped together on the AS3 side using the [RemoteClass(alias="com.dgrigg.vo.MyDataObject")] tag. If the AS3 object contains a public Array or ArrayCollection that has not been instantiated Flash remoting dies when trying to pass the object down to Java. Not entirely sure why but lesson learned, always instantiate Arrays and ArrayCollections in a data object before sending it down the wire.

Jul 16, 2008 at 10:18 PM
Derrick.
My understanding would be that until you instanciate the Array / Array collection, then it doesn't actually exist as far as remoting is concerned.
I think whether remoting dies or not is down to the individual rules on thye conversion with whatever remoting gateway you are using (BalzeDS, original Macromedia Java remoting .jar, OpenAMF etc).
When I did some tests recently with BalzeDS, any properties which weren't defined on either side ( say the Java VO had a name property and Flash didn't) were just ignored, and the VO shipped just didn't include the missing property.
Aran
Jul 17, 2008 at 7:40 AM
Hey Aran,
I am using BlazeDS. Non declared properties on either side that are basic data types (ie int, string, boolean) get passed back and forth both ways and properly ignored if not declared on the receiving end, however the arrays and array collections seem to go against that rule.
I think you're right that it likely comes down the gateway being used, I haven't seen similar behaviour using WebOrb (not that I purposely tested for that though).
Doing some Googling I came across this:
Maybe part of the issue is that the serializer can not determine which type of array (strict or dense) a null array is and it gets hung.
Derrick