我想要做的就是走一個對象,這也是對象和輸出的ActionScript 3代碼花(或需要)來創建實例化並填充物和一個複雜的樹所有的孩子。AS3對象序列化(至AS3代碼)
因此,例如,如果你看到在調試器像這樣
myObjectToParse ([email protected])
----------[0]someBlob ([email protected])|null
----------[1]someChildren ([email protected])
--------------------[0]childFoo ([email protected])
------------------------------someProperty ([email protected]) | 45
------------------------------someOtherProperty ([email protected]) | 45
--------------------[1]childBar ([email protected])
------------------------------someStringProperty([email protected]) | "hello world"
出口商會吐出:
public class MySerialized extends ParseMe
{
public var someBlob:SomeBlob;
public var someChildren:Array;
public function MySerialized()
{
//populateSomeBlob(); //its null so the export doesn't write it out
populateSomeChildren();
}
private function populateSomeChildren()
{
someChildren=new Array(2);
var childFoo:ChildFoo=new ChildFoo();
childFoo.someProperty=45;
childFoo.someOtherProperty=45;
childFoo.someProperty=45;
childFoo.someOtherProperty=45;
var childBar=new ChildBar();
childBar.someStringProperty="hello world";
someChildren[0]=childFoo;
someChildren[1]=childBar;
}
}
任何提示嗎?想法?謝謝!
編輯:我想我可能最終只是試圖序列化爲一個amf ByteArray ...聽起來更簡單,但我沒有玩過,不知道它可以去多少級別以及什麼類型的引用它支持。
請注意,形狀在Flash IDE中繪製的內容不能通過AS3獲取...... :( – Cay 2009-07-27 19:29:07