title: Remove Movie clip as3
body: <p>Ok this has been driving me nuts for the past couple of hours and i know there is an easy answer.</p>
  
  <p>I have a scrollPane which has a movie clip called right_container_mc as it's source.
  Inside this right_container_mc I have other other movie clips called execiseBox that get added (in the correct positions on the stage) from an array with a for loop.
  Each exercise box has a button symbol called close_btn.</p>
  
  <p>Firstly I'm not sure that this is the best way to achieve this so feel free to suggest a better way!</p>
  
  <p>What I want to do is when this close_btn is clicked remove the specific exerciseBox movieclip from the array and from the stage then loop through the array again so all of the exercise box movieclips update their position on the stage.</p>
  
  <p>I am having trouble getting a reference to the movie clip because it is nested to remove it from the array and stage. Here is the code I have so far, need to add in the removing and updating parts. Also is should I be removing all of the current instances of the exerciseBox movie clips before the array loop runs each time??</p>
  
  <p>Any help is greatly appreciated. </p>
  
  <pre><code> function addMovieClipsToStage(event:MouseEvent):void
     {
      scrollPaneRight.source = right_container_mc;
      exerciseBox = new Exercisebox();
      exerciseBox.close_btn.addEventListener(MouseEvent.CLICK, onRemoveBox);
      boxArray.push(exerciseBox);
      sortBoxes();
      scrollPaneRight.update();
     }
  
      function onRemoveBox(event:MouseEvent):void
     {
  
     }
  
     function sortBoxes():void
     {
      for (var i:int =0; i&lt;boxArray.length; i++)
      {
       right_container_mc.addChild(exerciseBox);
       exerciseBox.x = 0;
       exerciseBox.y = ((115 + 3)*i);
  
      }
  
     }
  </code></pre>