# How to remove child?

**URL:** https://forum.kirupa.com/t/how-to-remove-child/288647
**Category:** flash
**Created:** [May 19, 2009, 12:08pm UTC](https://forum.kirupa.com/t/how-to-remove-child/288647 "2009-05-19T12:08:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kadaj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kadaj/32/9061_2.png) [@kadaj](https://forum.kirupa.com/u/kadaj)
#### Post date: [May 19, 2009, 12:08pm UTC](https://forum.kirupa.com/t/how-to-remove-child/288647/1 "2009-05-19T12:08:56Z")

</div>

When beginning without any key pressed the ryustance\_mc plays as it should.  
When right or left key is pressed the ryuwalk\_mc plays but the ryustance\_mc plays at the background. How to remove it from the holder?  
The thing is when I stop pressing any of the keys then ryustance\_mc must play again.

function control(event:Event):void  
{  
if(rightKeyIsDown) {  
holder\_mc.addChild(ryuwalk\_mc);  
ryuwalk\_mc.play();  
holder\_mc.x += speed;  
}  
if(leftKeyIsDown) {  
holder\_mc.addChild(ryuwalk\_mc);  
ryuwalk\_mc.play();  
holder\_mc.x -= speed;  
}  
}

initializeGame();

```auto
[img]/uploads/kirupa/5410/d54ca2b5c14af6bc.jpg[/img]

Please help me.
Thank You
```
