title: Flash AS3: The supplied DisplayObject must be a child of the caller error
body: <p>I am creating some action script to simulate 3 button states and load in movie clips accordingly.</p>
  
  <p>I'm getting this error</p>
  
  <pre><code>ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/removeChild()
      at Untitled_fla::MainTimeline/sack_btnMouseOut()
  </code></pre>
  
  <p>When trying to do this</p>
  
  <pre><code>//get the objects
  var addSackStill:sack_still = new sack_still();
  var addSackHover:sack_hover = new sack_hover();
  var addSackClick:sack_click = new sack_click();
  
  //add the still object to the stage
  addChild(addSackStill);
  var SACK_X = 570.55;
  var SACK_Y = 603.95;
  addSackStill.x = SACK_X;
  addSackStill.y = SACK_Y;
  addSackHover.x = SACK_X;
  addSackHover.y = SACK_Y;
  addSackClick.x = SACK_X;
  addSackClick.y = SACK_Y;
  
  //create the event listeners
  addSackStill.addEventListener(MouseEvent.MOUSE_OVER, sack_btnMouseOver);
  addSackHover.addEventListener(MouseEvent.MOUSE_OUT, sack_btnMouseOut);
  addSackHover.addEventListener(MouseEvent.CLICK, sack_btnClick);
  
  
  //here are the functions for mouse over, mouse off, and click
  function sack_btnMouseOver(event:MouseEvent):void {
      trace("mouse over");
      removeChild(addSackStill); //remove the movie clip
      addChild(addSackHover); //add sackclick to the stage
  }
  
  function sack_btnMouseOut(event:MouseEvent):void {
      trace("mouse out");
      removeChild(addSackHover); //remove the movie clip
      addChild(addSackStill); //add sackclick to the stage
  }
  
  function sack_btnClick(event:MouseEvent):void {
      trace("Click");
      removeChild(addSackHover); //remove the movie clip
      addChild(addSackStill); //add sackclick to the stage
  }
  </code></pre>
  
  <p>Am I doing something wrong?</p>