title: I would like to know how I would be able to implement pausing in my flash game
body: <p>During early development of my game I did not really regard how the game will be paused in case the player gets interrupted.  I figured it shouldn't be anything too difficult so I left it as something I would look into once I got the core of the game finished.</p>
  
  <p>I'm here now and trying to figure out a way to pause my game is very difficult, from my point of view anyway.</p>
  
  <p>As of now I followed a few tutorials to get to where I am today, mainly tutorials from <a href="http://asgamer.com/" rel="nofollow">ASGamer</a>.  The preloader and menu screens tutorial that can be found at that site is what I used and so far I've had a few problems which I will ask later.</p>
  
  <p>Anyway I find it difficult to wrap my head around how I would be able to pause or suspend game play when the user presses a designated key.  I guess I should explain how my game functions.</p>
  
  <p>I have 3 frames in my main timeline.</p>
  
  <p>First frame is for the preloader, simple.</p>
  
  <p>Second frame is where the game is.  It has my asset holder and all my scripts run when on that frame.</p>
  
  <p>Third frame is stop(); action.</p>
  
  <p>Once the preloader finishes my the "Menu Screens" starts, this is the tutorial I followed.  It loads and unloads movieclips with UnLoad() and Load().</p>
  
  <p>I use Load() to load the main menu which happens at the beginning, then use UnLoad() to unload the current menu then load the next designated menu, for example Main Menu -> the Game I use <code>Unload(new GameMenu(stage));</code> The stage is constantly passed back and forth with these menus so it gets confusing sometimes.</p>
  
  <p>In the GameMenu is where I run the game from, I made a class GamePlay that extends MovieClip.  From there it spawns the players and enemies and plays as a normal game, this is where my problem begins.</p>
  
  <p>First I tried to create a key handler to get key presses from the user.  At one point it worked the key presses were registering but after I made some changes to other scripts the key presses were not recognized any more.  So I moved the key presses to my Main.as which is the main script that my fla uses.  The keyboard events work fine, but now actually stopping the game...how do I even begin?  I would have to stop all movieclips and eventlisteners until the user presses the designated pause button again, how would I accomplish this?</p>
  
  <p>I read somewhere that using state machines is the best bet for having a pause in any game, but I'm not sure how to do this but I'm sure there are tutorials and blogs I can read to make a state machine, but if I did add one or make one would I have to redo all my code to accommodate state machines?</p>