A few lessons learned while serializing custom classes.
Compiler metadata tags only get you part of the way. Metadata alone is perfectly suitable when you’re not serializing classes with members that contain complex datatypes where those complex types have private members.
If there are private members in your complex data types then you’ll need to implement IExternalizable.
IExternalizable requires implementing two methods, ‘readExternal’ and ‘writeExternal’.
Another thing to watch out for is that it appears you must use a no args constructor in order to deserialize an object. If anyone knows otherwise please leave details in the comments.
AS3 makes it ultra simple to serialize variables via the IDataInput and IDataOutput objects. You just need to remember, when writing out things like Strings, to use writeUTF / readUTF rather than writeUTFBytes / readUTFBytes. The writeUTF method inserts a UTF string representing the number of bytes in each String which means you don’t have to do any grunt work when deserializing with readUTF — nice.