# ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller

**URL:** https://forum.kirupa.com/t/argumenterror-error-2025-the-supplied-displayobject-must-be-a-child-of-the-caller/261888
**Category:** Uncategorized
**Created:** [June 1, 2008, 10:48am UTC](https://forum.kirupa.com/t/argumenterror-error-2025-the-supplied-displayobject-must-be-a-child-of-the-caller/261888 "2008-06-01T10:48:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imaginex](https://avatars.discourse-cdn.com/v4/letter/i/7993a0/32.png) [@imaginex](https://forum.kirupa.com/u/imaginex)
#### Post date: [June 1, 2008, 10:48am UTC](https://forum.kirupa.com/t/argumenterror-error-2025-the-supplied-displayobject-must-be-a-child-of-the-caller/261888/1 "2008-06-01T10:48:42Z")

</div>

Hi all,

I’m trying to modify a flex utility called photoNavigator. Basically all it does is that it loads a high res jpeg image and allows the user to magnify a portion of the image.

what im trying to do is allow the user to load different images. Obviously i try and remove the previous instance of photoNavgator and add a new instance (which contains the new file location as well). This is the simple code:

* * *

public function init():void  
{  
photo1 = new PhotoNavigator(‘pic1.jpg’);  
addChild (photo1);  
}

public function button9Handler(event:MouseEvent)  
{  
removeChild(photo1); // removes the previous instance of PhotoNavigator - works  
photo2 = new PhotoNavigator(‘pic2.jpg’);  
addChild(photo2);//trying to add a new instance of PhotoNavigator - doesnt work  
}

* * *

this is the error message i get.

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display::DisplayObjectContainer/removeChild()  
at org.flepstudio::PhotoNavigator/setComplete()

please help!!!
