Hey, I got this Keypress events. It works with arrow keys, Space, etc. But i need it to register the X and Z events. Which wont work for some reason. Here is all the code associated with the keypress event: Please help me. Thank you =]
var X_PRESSED:Boolean = false; var Z_PRESSED:Boolean = false;
function startGame() { Theres other code in here, im just sectioning out just the keyboard event. . .
I don't think you can use refrences to x and z keys like you can with arrow keys. you need to use the actual keyCode for x it is 120 and for z it is 122.
a list of flash key codes http://people.uncw.edu/tompkinsj/112/flashactionscript/keycodes.htm
What you error msg is saying is that there is no Z variable or constant in the keyboard class.
If you want to use it more often, just create a static class once called KeyCodes, and add all the possible keycodes in it... that way, you can use KeyCode.Z, as opposed to using the numbers every time!
If you want to use it more often, just create a static class once called KeyCodes, and add all the possible keycodes in it... that way, you can use KeyCode.Z, as opposed to using the numbers every time!
...or just use as3's built in Keyboard class. I think it's in flash.ui or something...