Mike, The recent update to the AMF spec adds support for Vectors, Dictionary, etc.[1] Will this help us with this problem?
Thanks, Om [1] http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/amf/pdf/amf-file-format-spec.pdf On Thu, Apr 5, 2012 at 1:55 PM, Michael A. Labriola < [email protected]> wrote: > Okay, now that we almost have a VectorCollection, we have a bridge to > cross... Serialization or actually Deserialization. > > If I serialize this Vector: > > var vector:Vector.<String> = new Vector.<String>(); > var vector2:Vector.<String>; > > var ba:ByteArray = new ByteArray(); > ba.writeObject( vector ); > > All is well. However, when I deserialize it, I will receive a crash: > > ba.position = 0; > vector2 = ba.readObject(); > > TypeError: Error #1034: Type Coercion failed: cannot convert > __AS3__.vec::Vector.<Object>@620f061 to __AS3__.vec.Vector.<String>. > > That is because, when it attempt to deserialize the ByteArray, it does so > as a Vector of type Object as it does not properly recognize the alias of > the type of the Vector's contents. Now, for fun, if I first register a > class alias for String: > > registerClassAlias( "String", String ); > > All works properly, as the alias of String is looked up and properly > deserialized. So, given this little bit of frustration. What would everyone > think about further modifying the compiler to add registrations for the > basic types in the startup of Flex apps? In the > _ProjectName_FlexInit-generated.as, the compiler already adds to > registerClassAlias calls for ObjectProxy to work around some memory leak > issues. We could add registrations for the basic types right here. This > would mean the Vectors, and hence VectorCollection and VectorList instance, > would deserialize as expected in our Flex apps. > > This is the first of many compiler changes I have made and want to discuss. > > Thoughts? > Mike > > > digital primates (r) > > Michael Labriola > [email protected]<mailto:[email protected]> > > tel: +1.773.693.7800 x206 > fax: +1.773.409.9251 >
