Hey what’s up? Long time reader first time poster. =P
(This question pertains to a game I am making, but the question itself is about actionscript. Not game programming.)
Okay I’m making a game in which the player must use the num pad keys to toggle switches. Which is no sweat but theres a huge problem. That flipping numlock key. If it’s off the key codes change using Key.getCode(); or Key.getAscii();
So for example when the numlock is on 1 returns key code 97. But when numlock is off it returns 35 (for the key ‘End’).
Is there a way to disable or set the numlock key to on or ‘toggled’ when starting a flash movie?
Any ideas/help would be appreciated. Thanks alot. :cap:
Just wanted to mention that keystroke handling is an excellent time to
be using the switch statement, which is more efficient than a bunch of ifs.
switch (Key.getCode())
{
case 97:
case 35:
// do something
break;
case 98:
case 36:
// do something else
break;
default:
trace("What kinda krazy keys are you pressing, homestar?");
}