# RemoveChild Issue

**URL:** https://forum.kirupa.com/t/removechild-issue/326373
**Category:** flash
**Created:** [December 9, 2011, 1:46pm UTC](https://forum.kirupa.com/t/removechild-issue/326373 "2011-12-09T13:46:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nitin\_Pasricha](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@Nitin\_Pasricha](https://forum.kirupa.com/u/Nitin_Pasricha)
#### Post date: [December 9, 2011, 1:46pm UTC](https://forum.kirupa.com/t/removechild-issue/326373/1 "2011-12-09T13:46:51Z")

</div>

Hi,

i have about 5 buttons on my site with 5 seperate movie clips (in my library which ive set to export fro runtime)

now each button loads its respective movieclip from the library using this code:

function onReleaseHandleraboutBTN(myEvent:MouseEvent)  
{  
\*\* var myMovieClip:MovieClip = new aboutMC();\*\*  
\*\* addChild(myMovieClip);\*\*  
\*\* myMovieClip.x = 20;\*\*  
\*\* myMovieClip.y = 40;\*\*  
}

now this works perfectly and loads up my movieclip hassle free.

what i want to do is that when i click on another button it should close the existing movieclip and open its own movie clip, the code i used for that is:

function onReleaseHandlerfaqBTN(myEvent:MouseEvent)  
{  
\*\* var myMovieClip:MovieClip = new aboutMC();\*\*  
\*\* this.removeChild(myMovieClip);\*\*  
}

which is where im stuck as it gives me an error:

**ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.**  
\*\* at flash.display:DisplayObjectContainer/removeChild()\*\*  
\*\* at index\_fla::MainTimeline/onReleaseHandlerfaqBTN()\*\*

im really new to coding, some one please help me out here ☹ thanks in advance

Regards,  
Nitin
