title: Trouble serializing vectors in a sub-class in AS3
body: <p>Hey there! I'm trying to serialize data in AS3 but am running into a frustrating problem. Originally I had problems with "myObjClass" not being convertible, but after I discovered "registerClassAlias" I got things working allright.</p>
  
  <p>Some time later, I added vectors to the myObjClass. I ran into trouble with Vector Strings before, as was reported here:</p>
  
  <p><a href="https://bugs.adobe.com/jira/browse/FP-6693" rel="nofollow">https://bugs.adobe.com/jira/browse/FP-6693</a></p>
  
  <p>So I know the workaround is to include:</p>
  
  <pre><code>registerClassAlias("String", String);
  </code></pre>
  
  <p>I'm just not sure how to register an alias for a subvector within a vector (along with other variables). Here's my code:</p>
  
  <pre><code>var newObj:myObjClass = new myObjClass();
  newObj.mySubXML = new Vector.&lt;XML&gt;();
  newObj.mySubString = new Vector.&lt;String&gt;();
  
  var myObj:Vector.&lt;myObjClass&gt; = new Vector.&lt;myObjClass&gt;();
  myObj.push(newObj);
  
  registerClassAlias("String", String); // Problem #1
  registerClassAlias("XML", XML);       // Problem #1
  registerClassAlias("VecMyObjClass", Vector.&lt;myObjClass&gt; as Class); // Problem #2
  // registerClassAlias("myObjClass", myObjClass); // This and the above are interchangable (same errors)
  var bytes:ByteArray = new ByteArray();
  bytes.writeObject(myObj);
  bytes.position = 0;
  myObj = bytes.readObject();
  </code></pre>
  
  <p>Problem #1: When these two lines are included in my compilation, the final line (bytes.readObject()) fails with the error:</p>
  
  <pre><code>Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.&lt;Object&gt;@42edb21 to __AS3__.vec.Vector.&lt;myObjClass&gt;.
  </code></pre>
  
  <p>This is really strange. It's as if the first two registerClassAlias's are undoing the third one.</p>
  
  <p>Problem #2: If I comment out the two "first problem" lines (string/xml classalias registrations) it converts myObj to myObjClass just fine; no internal error is thrown and the application is not halted. However, it fails to convert the internal String and XML vectors, with this error appearing in the application Output (without halting):</p>
  
  <pre><code>TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.&lt;Object&gt;@3aabc11 to __AS3__.vec.Vector.&lt;XML&gt;.
  TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.&lt;Object&gt;@3aabc41 to __AS3__.vec.Vector.&lt;String&gt;.
  </code></pre>
  
  <p>So my question is, How can I register a class alias for:</p>
  
  <ul>
  <li>Vector.(myObjClass)</li>
  <li>A vector of Strings as a property of Vector.(myObjClass)</li>
  <li>A vector of XML as a property of Vector.(myObjClass)</li>
  </ul>
  
  <p>All at the same time?</p>