0% found this document useful (0 votes)
444 views6 pages

Keyboard Keys and Key Code Values

This document provides tables listing the key codes and ASCII values for keys on a standard keyboard. It describes how to use ActionScript code to capture key presses and output the corresponding key code and ASCII value to trace. The tables include letters, numbers, function keys, navigation keys, and other special keys; and their associated key codes are given to identify the keys in ActionScript code.

Uploaded by

Huy Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
444 views6 pages

Keyboard Keys and Key Code Values

This document provides tables listing the key codes and ASCII values for keys on a standard keyboard. It describes how to use ActionScript code to capture key presses and output the corresponding key code and ASCII value to trace. The tables include letters, numbers, function keys, navigation keys, and other special keys; and their associated key codes are given to identify the keys in ActionScript code.

Uploaded by

Huy Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Keyboard Keys and Key Code Values

The following tables list all the keys on a standard keyboard and the corresponding key code values and ASCII key code values that are used to identify the keys in ActionScript: You can use key constants to intercept the built-in behavior of keypresses. For more information on the on() handler, see on handler in the ActionScript 2.0 Language Reference. To capture key code values and ASCII key code values using a SWF file and key presses, draw a text field on the Stage. Select Input Text from the Text Type drop-down menu in the Properties panel, and click the Show border around text option. Then paste the following ActionScript code into the actions panel for the current Frame on the Timeline: var keyListener:Object = new Object();

keyListener.onKeyDown = function() { trace("DOWN -> Code: " + Key.getCode() + "\tACSII: " + Key.getAscii() + "\tKey: " + chr(Key.getAscii())); }; Key.addListener(keyListener);

For more information on the Key class, see Key in ActionScript 2.0 Language Reference. To trap keys when you test a SWF file in the authoring environment (Control > Test Movie), make sure that you select Control > Disable Keyboard Shortcuts.

Letters A to Z and standard numbers 0 to 9


The following table lists the keys on a standard keyboard for the letters A to Z and the numbers 0 to 9, with the corresponding key code values that are used to identify the keys in ActionScript: Letter or number key A B C D E F G H I J Key code 65 66 67 68 69 70 71 72 73 74 ASCII key code 65 66 67 68 69 70 71 72 73 74

K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 a b c d e

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 48 49 50 51 52 53 54 55 56 57 65 66 67 68 69

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 48 49 50 51 52 53 54 55 56 57 97 98 99 100 101

f g h i j k l m n o p q r s t u v w x y z

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

Keys on the numeric keypad


The following table lists the keys on a numeric keypad, with the corresponding key code values that are used to identify the keys in ActionScript: Numeric keypad key Numpad 0 Numpad 1 Numpad 2 Numpad 3 Numpad 4 Numpad 5 Key code 96 97 98 99 100 101 ASCII key code 48 49 50 51 52 53

Numpad 6 Numpad 7 Numpad 8 Numpad 9 Multiply Add Enter Subtract Decimal Divide

102 103 104 105 106 107 13 109 110 111

54 55 56 57 42 43 13 45 46 47

Function keys
The following table lists the function keys on a standard keyboard, with the corresponding key code values that are used to identify the keys in ActionScript: Function key F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 112 113 114 115 116 117 118 119 120 This key is reserved by the system and cannot be used in ActionScript. 122 123 124 125 126 Key code 0 0 0 0 0 0 0 0 0 This key is reserved by the system and cannot be used in ActionScript. 0 0 0 0 0 ASCII key code

F11 F12 F13 F14 F15

Other keys

The following table lists keys on a standard keyboard other than letters, numbers, numeric keypad keys, or function keys, with the corresponding key code values that are used to identify the keys in ActionScript: Key Backspace Tab Enter Shift Control Caps Lock Esc Spacebar Page Up Page Down End Home Left Arrow Up Arrow Right Arrow Down Arrow Insert Delete Num Lock ScrLk Pause/Break ;: =+ -_ /? `~ [{ \| ]} Key code 8 9 13 16 17 20 27 32 33 34 35 36 37 38 39 40 45 46 144 145 19 186 187 189 191 192 219 220 221 ASCII key code 8 9 13 0 0 0 27 32 0 0 0 0 0 0 0 0 0 127 0 0 0 59 61 45 47 96 91 92 93

"' , . /

222 188 190 191

39 44 46 47

For additional key code and ASCII values, use the ActionScript at the beginning of this appendix and press the desired key to trace its key code.

You might also like