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.
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:
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