views:

445

answers:

1

For a class project I have made a clean the ocean "hidden pictures" game with as3, and when you click on a hidden picture it highlights it and in the legend, moves the object in the legend to a "trash bin".

All this was done pretty easily, but now comes to making the game restart...

Since all the animation in this project has to done in AS3 and no frames, tweens or scenes are used, then how do I make a reset button. GotoandPlay won't work since there is only 1 frame.

Is there a command for removing all mouseclick events?

Thank you in advance,

Stephen

+1  A: 

I think in this case it is best to model your game in an class that is initialized into the starting state. Then all your resetbutton has to do is remove the current game-object and create a new one (or re-initialize the current one).

Maybe there is an AS3 command to restart your program, but I'm not sure about that.

Lex
To add to Lex's comment, what I find works well is that when you make your class, create a dispose() function to go with it. Which basically trashes all created objects and resets all your variables back to defaults.It's always a good idea to keep track of every DisplayObject you create, that will later need to be purged.
Daniel Carvalho