开发者

Convert Object into XML element (and viceversa) in AS3

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 propert开发者_Python百科ies) 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 your DisplayObject can be summarize with some properties (the URL of an image in a Loader, or the size and color of a rectangle in a Shape) you can develop an ad hoc serializer. But this won't work for any custom Sprite.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜