Drew Schug's Blog about search engine optimization, technology, web design, marketing, dogs and general life items.

Wednesday, November 19, 2008

Flash Actionscript Keycodes

Searched for a while to find this: reposting
Key codes and character codes for Flash

Ascii String Code
8 (backspace) 8
13 (enter) 13
0 (shift) 16
0 (ctrl) 17
0 (alt) 18
0 (capslock) 20
27 (esc) 27
32 (space) 32

w/o shift key
48 0 48
49 1 49
50 2 50
51 3 51
52 4 52
53 5 53
54 6 54
55 7 55
56 8 56
57 9 57
97 a 65
98 b 66
99 c 67
100 d 68
101 e 69
102 f 70
103 g 71
104 h 72
105 i 73
106 j 74
107 k 75
108 l 76
109 m 77
110 n 78
111 o 79
112 p 80
113 q 81
114 r 82
115 s 83
116 t 84
117 u 85
118 v 86
119 w 87
120 x 88
121 y 89
122 z 90
59 ; 186
61 = 187
44 , 188
45 - 189
46 . 190
47 / 191
96 ` 192
91 [ 219
92 \ 220
93 ] 221
39 ' 222

w/ shift key
41 ) 48
33 ! 49
64 @ 50
35 # 51
36 $ 52
37 % 53
94 ^ 54
38 & 55
42 * 56
40 ( 57
65 A 65
66 B 66
67 C 67
68 D 68
69 E 69
70 F 70
71 G 71
72 H 72
73 I 73
74 J 74
75 K 75
76 L 76
77 M 77
78 N 78
79 O 79
80 P 80
81 Q 81
82 R 82
83 S 83
84 T 84
85 U 85
86 V 86
87 W 87
88 X 88
89 Y 89
90 Z 90
58 : 186
43 + 187
60 < 188
95 _ 189
62 > 190
63 ? 191
126 ~ 192
123 { 219
124 | 220
125 } 221
34 " 222

Keypad Keys w/numlock on
13 (enter) 13
48 0 96
49 1 97
50 2 98
51 3 99
52 4 100
53 5 101
54 6 102
55 7 103
56 8 104
57 9 105
42 * 106
43 + 107
45 - 109
46 . 110
47 / 111

Keypad Keys w/numlock off
13 (enter) 13
0 (PgUp) 33
0 (PgDown) 34
0 (End) 35
0 (Home) 36
0 (left arrow) 37
0 (up arrow) 38
0 (right arrow) 39
0 (down arrow) 40
0 (Ins) 45
127 (Delete) 46
42 * 106
43 + 107
45 - 109
47 / 111

Side Keys
0 (Pause) 19
0 (PageUp) 33
0 (PageDown) 34
0 (End) 35
0 (Home) 36
0 (Ins) 45
127 (Delete) 46
0 (ScrollLock) 145

Arrow Keys
0 (left) 37
0 (up) 38
0 (right) 39
0 (down) 40

Function Keys
0 (F1) 112
0 (F2) 113
0 (F3) 114
0 (F4) 115
0 (F5) 116
0 (F6) 117
0 (F7) 118
0 (F8) 119
0 (F9) 120
0 (F10) 121
0 (F11) 122
0 (F12) 123

2 comments:

Anonymous said...

Bookmarked so that I may never have to do such a search myself. Thank you.

Unknown said...

Hey Drew!
Thanks for the great post on twitter resources!
http://troyworks.com/blog/2009/04/30/you-using-twitter-for-flash-actionscript/

While I don't have everything under the sun, I created a class that helps parse the key codes into static vars...at least for me it's easy eg.

switch(KeyCode.parse(keycode){

case KeyCode.A:
//do something
break;
case KeyCode.B:
//do something else
break;
}


Note that this only really works in US, on the basic as other countries may have different mappings for the extended Ascii.

It's viewable here.

http://code.google.com/p/troyworks/source/browse/trunk/AS3/dev/src/com/troyworks/framework/ui/KeyCode.as?r=18

FriendFeed