# ArgumentError: Error #2025:

**URL:** https://forum.kirupa.com/t/argumenterror-error-2025/291850
**Category:** flash
**Created:** [July 6, 2009, 6:59pm UTC](https://forum.kirupa.com/t/argumenterror-error-2025/291850 "2009-07-06T18:59:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pelagia](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@pelagia](https://forum.kirupa.com/u/pelagia)
#### Post date: [July 6, 2009, 6:59pm UTC](https://forum.kirupa.com/t/argumenterror-error-2025/291850/1 "2009-07-06T18:59:08Z")

</div>

Hi All

I have set up a series of buttons that show an image when rolled over and then the image disappears on roll out. A sample of the code I am using is below:

costume\_btn.addEventListener(MouseEvent.MOUSE\_OVER, loadCostume);

function loadCostume (e:MouseEvent):void {  
var newCos:feather = new feather ();  
this.addChild(newCos);  
newCos.x = 600;  
newCos.y = 222;

costume\_btn.addEventListener(MouseEvent.MOUSE\_OUT, closeBrad)

function closeBrad (e:MouseEvent):void {  
removeChild(newCos);  
}  
}

scenic\_btn.addEventListener(MouseEvent.MOUSE\_OVER, loadScenic);

function loadScenic (e:MouseEvent):void {  
var newCos:brad = new brad ();  
this.addChild(newCos);  
newCos.x = 500;  
newCos.y = 100;

scenic\_btn.addEventListener(MouseEvent.MOUSE\_OUT, closeBrad)

function closeBrad (e:MouseEvent):void {  
removeChild(newCos);  
}  
}

It works fine first time through but on roll out the second time you visit any button it gives me the following error message:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display::DisplayObjectContainer/removeChild()  
at MethodInfo-12()

What have I missed?

Thanks for your time y’all:jamesbond:
