# Kicking those children OUT

**URL:** <https://forum.kirupa.com/t/kicking-those-children-out/311040>\
**Category:** flash\
**Created:** [June 25, 2010, 8:23pm UTC](https://forum.kirupa.com/t/kicking-those-children-out/311040 "2010-06-25T20:23:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [June 25, 2010, 8:23pm UTC](https://forum.kirupa.com/t/kicking-those-children-out/311040/1 "2010-06-25T20:23:54Z")

</div>

Here’s the setup  
new game screen can go to new game OR how to play screen  
how to play screen goes to new game

my doc class pulls both in as per need but I cant figure out how to remove the neccesary child to start into the game. I can get one to work but with both i get:[COLOR=Red] ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display::DisplayObjectContainer/removeChild()  
at AsteroidSupplyV2/NewGameFCN()  
[/COLOR]  
here’s the code  
package  
{  
import flash.display.MovieClip  
import flash.events.MouseEvent;

```
public class AsteroidSupplyV2 extends MovieClip
{
    var newGameScreen:NewGameScreen = new NewGameScreen;
    var howToPlayScreen:HowToPlay = new HowToPlay;
    public function AsteroidSupplyV2():void
    {
        trace ("asteroidSupplyV2");
        addChild(newGameScreen);
        newGameScreen.x=width/2;
        newGameScreen.y=height/2
        newGameScreen.newGame_btn.addEventListener(MouseEvent.CLICK,NewGameFCN);
        newGameScreen.howToPlay_btn.addEventListener(MouseEvent.CLICK,howToPlayFCN);
    }
    public function howToPlayFCN(howToPlay_btnEvt:MouseEvent)
    {
        newGameScreen.newGame_btn.removeEventListener(MouseEvent.CLICK,newGameScreen.NewGameFCN);
        newGameScreen.howToPlay_btn.removeEventListener(MouseEvent.CLICK,howToPlayFCN);
        removeChild(newGameScreen);
        addChild(howToPlayScreen);
        howToPlayScreen.x=width/2;
        howToPlayScreen.y=height/2
        howToPlayScreen.newGame_btn.addEventListener(MouseEvent.CLICK,NewGameFCN)
        
    }
    
    
    public function NewGameFCN(newGameFCNEvt:MouseEvent)
    {
        //removeChild(newGameScreen);
        //removeChild(howToPlayScreen);
        removeChild(newGameScreen);
        removeChild(howToPlayScreen);
        trace("NEWGAME!!!")
    }
}

```

}

HELP!!!😟
