charCode for arrow keys trace as 0
- Brossting
-
Brossting
- Member since: Jun. 6, 2011
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
Hey, this is my first post so forgive me if I leave anything out,
I've got a KEY_DOWN event that checks the charCode of a pressed key, I need the event to check for left and right arrow keys. So within I write:
if (e.charCode == 37){
slowDown();
}else if (e.charCode == 39){
speedUp();
}
This method works for other keys and their respective charCodes but doesn't for these, so I check what it wants with:
trace(e.charCode);
pressing enter, space, letter keys etc. all trace their corresponding charCodes but the arrow keys output as 0. Am I missing something? Is there a specific event for the arrow keys instead?
Thanks, Brossting
- Sam
-
Sam
- Member since: Oct. 1, 2005
- Offline.
-
- Forum Stats
- Moderator
- Level 19
- Programmer
You want to compare the value of:
e.keyCode - Brossting
-
Brossting
- Member since: Jun. 6, 2011
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
That was pretty damn simple, thank you.
At 4/9/14 08:43 PM, Sam wrote: You want to compare the value of:
e.keyCode

