nix
nix

Reputation: 2285

Pause absolutely all processes in Flash game

Like when pressing (not clicking!!!) the windows |X| button on the game window. Is that possible? Or will I have to write custom pause function? :S I have a very complicated program, and now I want to add PAUSE button.

Upvotes: 1

Views: 814

Answers (3)

user481081
user481081

Reputation:

If you've set an event listener for enterframe (like you should have), you can remove the listener during a pause, and add it back when unpaused. It will freeze the game on the exact frame when you paused.

Upvotes: 1

laurent
laurent

Reputation: 90766

Yes, sorry to say but you will have to add your own pause function. Flash does have a MovieClip::pause() function, but that only pause the frame animation, not the rest of the code execution.

Upvotes: 1

Justin Self
Justin Self

Reputation: 6265

In your game loop (before updating), just add a check for a "pause" state. If paused, don't update. Should be pretty easy to implement.

-Justin

Upvotes: 3

Related Questions