PDA

View Full Version : [AS3] reload .swf when select "play again"


ryrocks
04-17-2009, 10:25 PM
Hey,

I imagine this is a common issue.

I'm making a flash game in AS3. By the time the user gets to the end of the game all sorts of events have triggered and been removed, timers started and stopped, objected added and deleted etc etc....

When the user reaches the end of the game I want to have a "play again option". Would I have to go through all my code making sure everything starts back to normal when this option is selected? Surely not?!

Is it possible to reload the whole game from fresh? Or is there another option available?

Thanks

Gambyt
04-18-2009, 02:44 AM
you would need to loop the function or class that instantiates the game. No you would not have to rewrite your code but you would need to encapsulate it into the above described loop. The button can be the condition or trigger to continue the iteration.