# Identifying the type of child for if statements

**URL:** <https://forum.kirupa.com/t/identifying-the-type-of-child-for-if-statements/288037>\
**Category:** flash\
**Created:** [May 9, 2009, 8:35pm UTC](https://forum.kirupa.com/t/identifying-the-type-of-child-for-if-statements/288037 "2009-05-09T20:35:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaedo](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Shaedo](https://forum.kirupa.com/u/Shaedo)\
**Post date:** [May 9, 2009, 8:35pm UTC](https://forum.kirupa.com/t/identifying-the-type-of-child-for-if-statements/288037/1 "2009-05-09T20:35:35Z")

</div>

Hi, thanks for taking the time to look at my query:  
Essentially I want to know what to replace the \*\*[COLOR=red]1\_mc[/COLOR] \*\*with.

```auto
 
var various_mc:MovieClip = new 1_mc;
addChild(various_mc);
 
trace(various_mc) // [object 1_mc]
 
**if(various_mc == [COLOR=red]1_mc)[/COLOR]** // This causes the error. 
{
   removeChild(various_mc);
   various_mc = new 2_mc;
   addChild(various_mc);
}

```

The if statement runs on the click of a button. I want it so that if 1\_mc is on stage, its removed and 2\_mc is placed on the stage. At the moment I am doing this by placing them into a sprite and using it like a loader… but I thought maybe this would be a more efficient method.

Thanks!
