# TimerEvent / removeChild() Error #2025

**URL:** <https://forum.kirupa.com/t/timerevent-removechild-error-2025/270751>\
**Category:** flash\
**Created:** [September 13, 2008, 3:25pm UTC](https://forum.kirupa.com/t/timerevent-removechild-error-2025/270751 "2008-09-13T15:25:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CatB](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@CatB](https://forum.kirupa.com/u/CatB)\
**Post date:** [September 13, 2008, 3:25pm UTC](https://forum.kirupa.com/t/timerevent-removechild-error-2025/270751/1 "2008-09-13T15:25:35Z")

</div>

Hi

I’m a newbie to AS3 and need help with a TimerEvent / removeChild() problem. From a TimerEvent I’m calling a function that removes a child from the stage, except I get the following error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display::DisplayObjectContainer/removeChild()  
at intro\_fla::MainTimeline/fades\_six()  
at flash.utils::Timer/flash.utils:Timer::\_timerDispatch()  
at flash.utils::Timer/flash.utils:Timer::tick()

I can see the problem concerns the \_timerDispatch() but am unsure how to resolve. Here’s my code:

var imageData:textData = new textData(0, 0);

var imageBmpData:Bitmap = new Bitmap(imageData);  
imageBmpData.x = 50;  
imageBmpData.y = 50;

fades\_one();

function fades\_one():void {

```
var myDataTween:Tween = new Tween(imageBmpData, "alpha", Elastic.easeOut, 0, 100, 5000, true);
myDataTween.looping = false;

var timer:Timer = new Timer(3000, 1);
timer.addEventListener(TimerEvent.TIMER, fades_six);
timer.start();

```

}

function fades\_six(event:TimerEvent):void {  
removeChild(imageBmpData);  
}

Any advice gratefully received!

CatB
