title: The supplied DisplayObject must be a child of the caller
body: <p>I am a newbie, and I have seached and tried for weeks on this, and I cannot get the grip on this. The simple code below gives the "The supplied DisplayObject must be a child of the caller" error.</p>
  
  <pre><code>var square = new squareObj;
  addChild(square);
  addEventListener(Event.ENTER_FRAME, removeSquare);
  
  function removeSquare(evt:Event):void {
      removeChild(square)
  }
  </code></pre>
  
  <p>squareObj is a movieclip in the library which is exported for AS. How can this code be altered to make it work correctly?
  I guess it's my knowledge on proper oop I'm in lack of, so any links to good tutorials on the matter is appreciated.</p>
  
  <p>Regards H</p>