title: as3 object serialization (to as3 code)
body: <p>what i'm trying to do is walk an object that is also a complex tree of objects and output the actionscript 3 code it took (or takes) to create instantiate and populate that object and all its children.</p>
  
  <p>so for instance if you saw something like this in your debugger</p>
  
  <pre><code>myObjectToParse (ParseMe@173e239)
  ----------[0]someBlob (SomeBlob@173e322)|null
  ----------[1]someChildren (Array@173e239)
  --------------------[0]childFoo (ChildFoo@123e239)
  ------------------------------someProperty (Number@173e239) | 45
  ------------------------------someOtherProperty (Number@173e239) | 45
  --------------------[1]childBar (ChildFoo@123e239)
  ------------------------------someStringProperty(String@173e239) | "hello world"
  </code></pre>
  
  <p>The exporter would spit out:</p>
  
  <pre><code>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;
      }
  }
  </code></pre>
  
  <p>Any tips? Ideas? Thanks!</p>
  
  <p>Edit: I think i may end up just trying to serialize to an amf ByteArray...sounds simpler, but i haven't played with and don't know how many levels deep it can go and what types of references it supports.</p>