title: Having trouble with insertChildBefore and insertChildAfter in AS3
body: <p>I have an XML document:</p>
  
  <pre><code>var xml:XML = new XML(&lt;rootNode&gt;            
                  &lt;head&gt; 
                      &lt;meta name="template" content="Default" /&gt;
                  &lt;/head&gt;
                  &lt;mainSection&gt;
                      &lt;itemList&gt;
                          &lt;item&gt;
                              &lt;video src={this.videoURL}  /&gt;
                              &lt;img  src={this.src}&gt;&lt;/img&gt;
                          &lt;/item&gt;
                      &lt;/itemList&gt;
                  &lt;/mainSection&gt;
              &lt;/rootNode&gt;);
  </code></pre>
  
  <p>What I'd like to do, is when certain conditions are me, insert another  at the beginning of itemList. </p>
  
  <pre><code>var newNode:XMLList = new XMLList("&lt;item&gt;&lt;video src=\"" + _videoSource + "\"&gt;&lt;/video&gt;&lt;/item&gt;");
  </code></pre>
  
  <p>I'm able to generate and trace newNode just fine, but whenever I try to add it using <code>insertChildBefore</code>, it always returns undefined. </p>
  
  <pre><code>var contentNode:XML = new XML(xml.mainSection.itemList.item);
  xml.insertChildBefore(contentNode ,newNode)
  </code></pre>
  
  <p><code>contentNode</code> always traces fine, but it always fails when trying <code>insertChildBefore</code> or <code>insertChildAfter</code>. The weird thing is, if I make <code>contentNode</code> less specific (like <code>xml.mainSection</code>) then it works as expected. </p>
  
  <p>Thanks for any help, this is driving me insane! </p>