为什么是 XML?为什么不使用 AMF3 对其进行序列化?或者如果你需要一些人类可读的东西,JSON应该这样做。JSON 具有与 ECMA-script 完全相同的对象语义,是 ECMA-script 的一个子集,而 XML 没有,这使得使用 XML 非常烦人。
将第一个示意图表示为对象结构:
[
{"x":0, "y":0, "width":100, "height":25, "pattern":0 },
{"x":0, "y":25, "width":100, "height":25, "pattern":1 },
{"x":100, "y":0, "width": 50, "height":50, "pattern":2 },
{"x":50, "y":50, "width":100, "height":25, "pattern":0 },
{"x":50, "y":75, "width":100, "height":25, "pattern":1 },
{"x":0, "y":50, "width": 50, "height":50, "pattern":2 }
]
//this is both valid JSON and ActionScript, although in ActionScript, you would
//typically use identifiers instead of strings for property names
您可以使用as3corelib进行序列化。
问候
back2dos