# Need help understanding removeChild

**URL:** <https://forum.kirupa.com/t/need-help-understanding-removechild/295727>\
**Category:** flash\
**Created:** [September 3, 2009, 3:27pm UTC](https://forum.kirupa.com/t/need-help-understanding-removechild/295727 "2009-09-03T15:27:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mavwrx](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@mavwrx](https://forum.kirupa.com/u/mavwrx)\
**Post date:** [September 3, 2009, 3:27pm UTC](https://forum.kirupa.com/t/need-help-understanding-removechild/295727/1 "2009-09-03T15:27:31Z")

</div>

I am creating multiple instances of a movie class with the same variable name. The movie is then added random on the stage with a tween. On a mouse handler click, i want to remove the movie from the stage.

I am getting error -

> ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
> at flash.display::DisplayObjectContainer/removeChild()  
> at Untitled\_fla::MainTimeline/removeBlock()  
> What am I doing wrong?

```auto
import gs.TweenLite;
import flash.utils.*;

var block:block_mc;

var myTimer:Timer = new Timer(1000, 15);
myTimer.start();

myTimer.addEventListener(TimerEvent.TIMER, run); 

function run(event:TimerEvent):void {
    trace("run");
    trace(myTimer.currentCount);
    
    block = new block_mc;
    block.x = Math.round(Math.random() * 400); 
    block.y = Math.round(Math.random() * 400); 
    block.alpha = 0;
block.mouseChildren = false;
    stage.addChild(block); 
    TweenLite.to(block, 1, {alpha:1});
    stage.addEventListener(MouseEvent.CLICK, removeBlock); 
    
}

function removeBlock(event:MouseEvent):void{
removeChild(event.target);

}

```
