Skip to main content
February 21, 2009
Question

List of KeyCodes?

  • February 21, 2009
  • 1 reply
  • 849 views
In my Flash project, I know that the KeyCode recognizes 37-40 for the up/down/left/right arrow keys.

if (event.keyCode == 37) {
hero.moveLeft = true;
} else if (event.keyCode == 39) {
hero.moveRight = true;
}
if (event.keyCode == 38) {
hero.moveUp = true;
} else if (event.keyCode == 40) {
hero.moveDown = true;
}

And 32 as the spacebar at least. I was trying to make it so that the "s" or "i" or "g" key were recognized but when I did a trace on what keyCode value was picking up it would not recognize the "s" key unless I pressed the shift key. Oddly the "d" key would be recognized. While I am contempt on using the spacebar and other control keys instead, I was wondering if there's a chart somewhere as to what is recognized as keyCode, or if there's another property being used that recognizes the actual character representation instead (ie. 115=s, 37=%).
This topic has been closed for replies.

1 reply

Ned Murphy
Legend
February 22, 2009
In the testing mode, you have to turn off the keyboard shortcuts in the player for most keys to work (except those special ones you mentioned). Run the file and in the Flash Player, selected Control in the top toolbar and then select Disable Keyboard Shortcuts