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:

  1. Code Bits: Variables
  2. How to Make a Clock in Flash using Actionscript