how to make the pause menu depnds entirely upon how you've set up your game... we can't really help you with that unless you show us a lot of your code. As for key codes, I assume you are talking about the Key.isDown() function (which I don't use because I believe event listeners are a better programming practice). Note that the key class has several built-in constants, such as Key.LEFT, Key.RIGHT, etc, so if you just want to check if they're using those keys you can do if(Key.isDown(Key.LEFT)) { /*whatever*/ } If you want other keys, though, you have to use their specific scan codes, not ascii codes (as rino posted). I think I have a table bookmarked... hold on... http://www.pcguide.com/ref/kb/group.htm See how the codes are based on the location of the keys on the keyboard rather than what the key is itself? I think their might be issues with different operating systems, keyboards, drivers, etc that will make it not work on all computers...
Sorry about the double post but it turns out I'm probably wrong about the scan codes thing... though rino is also wrong about the ascii thing. Next time I'll actually do research instead of just assumptions =P
first of all those built in constants were in the Keyboard class, not Key, and secondly, the livedocs say Keyboard has built-in constants for all the keyboard keys... but the alpha-numeric ones are reserved for adobe AIR applications. Try using their values rather than referencing them directly, i.e use 80 instead of Keyboard.P or whatever
The easiest way to program a pause feature in your game is to have it in mind in the early stages of your game's development.
Here's two easy ways:
1. Have the game run off one single loop:
public function run(){ if(isPaused){ /*Place your pause feature scripts in here. You could bring in a new movieclip, such as pauseScreen, and load it ontop of everything else. */ } else{ /*Place your normal game functions in here*/ } }
2. Or you could set your game off a single timer in which all your functions are based off. To pause the game, you would simply use timerName.stop(); and timerName.start(); to resume.
For bringing in a pause menu, you could bring in a MovieClip with everything on it or have flash switch to a particular frame.
Note: by the normal game functions, I meant the regular code. You would have to place your other functions on the same elevation that the function run() runs off of.