# Removing Child

**URL:** https://forum.kirupa.com/t/removing-child/329274
**Category:** flash
**Created:** [August 8, 2012, 1:16am UTC](https://forum.kirupa.com/t/removing-child/329274 "2012-08-08T01:16:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wortic](https://avatars.discourse-cdn.com/v4/letter/w/91b2a8/32.png) [@wortic](https://forum.kirupa.com/u/wortic)
#### Post date: [August 8, 2012, 1:16am UTC](https://forum.kirupa.com/t/removing-child/329274/1 "2012-08-08T01:16:27Z")

</div>

Hello,  
if certain conditions are set, I’m creating an object. The object appears on the screen and then leaves the screen. I couldn’t find anyway to remove child after it completes its animation.(Using timer seemed a long way) So I decided to remove child while I’m leaving the frame. I tried  
if(myChild !== undefined)  
{  
removeChild(myChild);  
}  
I tought it would only check myChild if it is not undefined. However, flash doesnt even let me compile using the method above.  
It keeps saying access of undefined property myChild. I know it is undefined until it is created but why does flash check inside the if condition, if it is not met:h:
