title: AS3, removing node from XML by reference
body: <p>I am working with XML in ActionScript and trying to find a way to remove a node by providing the node reference.</p>
  
  <p>Sample:</p>
  
  <pre><code>var node:XML = 
  &lt;node&gt;
   &lt;child a="1" b="2" c="3" /&gt;
   &lt;child a="2" b="2" c="3" /&gt;
   &lt;child a="3" b="4" c="3" /&gt;
   &lt;child a="4" b="2" c="6" /&gt;
  &lt;/node&gt;;
  
  var targetChild:Xml = node.child.@(a==1)[0];
  </code></pre>
  
  <p>Currently, I am using the following to accomplish the removal of the node.
  Also I prefer not to iterate through the tree again or filter the nodes to find the targetChild i have already referenced.</p>
  
  <pre><code>delete (targetChild.parent().children()[targetChild.childIndex()]);
  </code></pre>
  
  <p>Somehow I just do not feel like it is a very clean way of doing it, but it works.
  I am wondering if there is another way to delete the node by reference?    </p>