# removeChild() problem

**URL:** <https://forum.kirupa.com/t/removechild-problem/314711>\
**Category:** flash\
**Created:** [October 6, 2010, 7:22pm UTC](https://forum.kirupa.com/t/removechild-problem/314711 "2010-10-06T19:22:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nhilez](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@nhilez](https://forum.kirupa.com/u/nhilez)\
**Post date:** [October 6, 2010, 7:22pm UTC](https://forum.kirupa.com/t/removechild-problem/314711/1 "2010-10-06T19:22:48Z")

</div>

I have created an image gallery that has company logos loaded into a movieclip at the bottom and scrolls based on the user’s mouse location. When the user clicks on one of the logos it should load the corresponding screenshot. The function for loading the screenshot is this:

```auto
 
function clickScrollerItem(me:MouseEvent):void {
 var imageLoader:Loader = new Loader();
 //removeChild(imageLoader);
 imageLoader.load(new URLRequest(me.currentTarget.src));
 fullImage.x = 10;
 fullImage.y = 20;
 fullImage.addChild(imageLoader);
 fadeTween = new Tween(imageLoader, "alpha", None.easeNone, 0, 1, 1, true);
}

```

The screenshots are of varying size, so I want to remove the one that’s currently displayed before loading the new one. When I do a

```auto
 
removeChild(imageLoader);

```

I get an error:  
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
Can anyone tell me what I’m doing wrong here?
