开发者

Convert Object into XML element (and viceversa) in AS3

开发者 https://www.devze.com 2023-04-06 12:19 出处:网络
Is there any way to convert an object into an XML element in AS3? I found this tutorial to serialize them:

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

精彩评论

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

关注公众号