title: flash as3 remove all children
body: <p>Isn't there a simple "remove all children" function in flash? I don't understand why this code isn't working. I add children via:</p>
  
  <pre><code>for (var i in project_array[cp].project_type_clips){
          container.header.type_loader.addChildAt(project_array[cp].project_type_clips[i],i);
          loadCount++
      }
  </code></pre>
  
  <p>and then remove them via:</p>
  
  <pre><code>for (var i in project_array[cp].project_type_clips){
          container.header.type_loader.removeChildAt(i);
      }
  </code></pre>
  
  <p>But I get an error that the supplied index is out of bounds, and yet one clip is still left on stage. Likewise, if I try to add them without levels, like this:</p>
  
  <pre><code>for (var i in project_array[cp].project_type_clips){
          container.header.type_loader.addChild(project_array[cp].project_type_clips[i]);
          loadCount++
      }
  </code></pre>
  
  <p>and remove:</p>
  
  <pre><code>for (var i in project_array[cp].project_type_clips){
          container.header.type_loader.removeChild(project_array[cp].project_type_clips[i]);
      }
  </code></pre>
  
  <p>I get the same error.</p>