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
labri...@digitalprimates.net<mailto:labri...@digitalprimates.net>

tel:  +1.773.693.7800 x206
fax: +1.773.409.9251

Reply via email to