# Restart game

**URL:** <https://forum.kirupa.com/t/restart-game/305107>\
**Category:** flash\
**Created:** [February 19, 2010, 9:01am UTC](https://forum.kirupa.com/t/restart-game/305107 "2010-02-19T09:01:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joepiooo](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@Joepiooo](https://forum.kirupa.com/u/Joepiooo)\
**Post date:** [February 19, 2010, 9:01am UTC](https://forum.kirupa.com/t/restart-game/305107/1 "2010-02-19T09:01:45Z")

</div>

Hello,

I’m making a memory game in Flash CS and got the following problem:  
The game is working perfect but I want to restart the whole game after you finished.

When all cards matches I remove the childs(cards) from the stage with this code.

```auto
if(_currentMatches >= _totalMatches)
                {
                    gotoAndStop(2);
                    timer.stop();
                    for (var i:int = 0; i < _cards.length; i++){
                    removeChild(_cards*);
                    }

```

What I want to do is reset the cards and timer when I click a button.  
I got the following code on my timeline:

```auto
btn_restart.addEventListener(MouseEvent.CLICK, onMouseClick_2);

function onMouseClick_2(e:MouseEvent):void
{
    for (var i:int = 0; i < _cards.length; i++){
    addChild(_cards*);
    }
}

```

This is putting back the childs(cards) agian… but they are not reset.  
The timer, shuffle, ect has to be reset. How can I realise that?

Somebody that can help me out? I’m getting a little bit desparate now.

Thank you

Joepiooo

PS: AS file included
