List of Flash Key Codes
Apr.21, 2009 in
Flash Actionscript
In Flash, I often find myself needing the code of a certain key for an aspect of my game. Whether the key codes are for movement, attacks, or item selection, using keys other than the generic left, right, up and down arrow keys is essential to many games.
Here’s the list of key codes for letters, in alphabetical order for ease of use:
A – 65
B – 66
C – 67
D – 68
E – 69
F – 70
G – 71
H – 72
I – 73
J – 74
K – 75
L – 76
M – 77
N – 78
O – 79
P – 80
Q – 81
R – 82
S – 83
T – 84
U – 85
V – 86
W – 87
X – 88
Y – 89
Z – 90
That’s it for letters. Here is the key codes for numbers:
0 – 48
1 – 49
2 – 50
3 – 51
4 – 52
5 – 53
6 – 54
7 – 56
8 – 57
9 – 58
There you go
Related posts:



May 9th, 2009 at 6:53 pm
How do we implement these?
is it just…
on(keypress(82){
gotoAndPlay(3)
}
or something like that?
May 9th, 2009 at 8:10 pm
It would be:
if(Key.isDown(82)){
gotoAndPlay(3);
}
February 9th, 2010 at 12:49 pm
Acctully there are two ways of doing this depending. Either:
on(keyPress”a”) {
_root.gotoAndPlay(3);
}
::: OR :::
onClipEvent(enterFrame) {
if(Key.isDown(65) {
_root.gotoAndPlay(3);
}
}
Then again, if you DID want a key such as the Space bar or Up arrow you would have to use these codes:
on(keyPress”") {
_root.gotoAndPlay(3);
}
::: OR :::
onClipEvent(enterFrame) {
if(Key.isDown(Key.SPACE)) {
_root.gotoAndPlay(3);
}
}