Is there any way to convert an object into an XML element in AS3?
I found this tutorial to serialize them:
http://cookbooks.adobe.com/post_Serializing_object_to_XML-11988.html
But I also need a way to unserialize to get the original object (with its own properties) and ready to stage.addChild
disclaimer: In the following message, when I write (un)serialize I talk about XML
You can (un)serialize a data object with properties such as numbers, arrays, objects or strings. But you can’t (un)serialize a graphic object if you don’t have all the instructions needed to rebuild it.
The last part of your question (adding to stage the unserialized object) made me think you want to (un)serialize a
DisplayObject. If the construction of yourDisplayObjectcan be summarize with some properties (the URL of an image in aLoader, or the size and color of a rectangle in aShape) you can develop an ad hoc serializer. But this won’t work for any customSprite.