AS3 KeyboardEvent: Actionscript 3 keyCode list

Below is a list of the CORRECT keyCodes for Actionscript 3.

Backspace = 8

Tab = 9

Enter = 13

Shift = 16

Control = 17

CapsLock = 20

Esc = 27

Spacebar = 32

PageUp = 33

PageDown = 34

End = 35

Home = 36

LeftArrow = 37

UpArrow = 38

RightArrow = 39

DownArrow = 40

Insert = 45

Delete = 46

NumLock = 144

ScrLk = 145

Pause/Break = 19

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

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

0 = 48

1 = 49

2 = 50

3 = 51

4 = 52

5 = 53

6 = 54

7 = 55

8 = 56

9 = 57

;: = 186

=+ = 187

-_ = 189

/? = 191

`~ = 192

[{ = 219

\| = 220

]} = 221

"' = 222

, = 188

. = 190

/ = 191

Numpad 0 = 96

Numpad 1 = 97

Numpad 2 = 98

Numpad 3 = 99

Numpad 4 = 100

Numpad 5 = 101

Numpad 6 = 102

Numpad 7 = 103

Numpad 8 = 104

Numpad 9 = 105

Numpad Multiply = 106

Numpad Add = 107

Numpad Enter = 13

Numpad Subtract = 109

Numpad Decimal = 110

Numpad Divide = 111

F1 = 112

F2 = 113

F3 = 114

F4 = 115

F5 = 116

F6 = 117

F7 = 118

F8 = 119

F9 = 120

F10 = nokey

F11 = 122

F12 = 123

F13 = 124

F14 = 125
F15 = 126

Find AS3 keycode:

Get Adobe Flash player

9 Responses to “AS3 KeyboardEvent: Actionscript 3 keyCode list”

  • dash says:

    How about posting the source code for this widget?

  • Stampastock says:

    No sabes que Ăștil fue!!!!!! .. gracias…..

  • pepeu says:

    Thanks mate! I needed this.

    Ah, and 18 for Alt-key.

    pepeu

  • bhushan says:

    excellent

  • silentx says:

    The Key F10 don't work ?

  • palani says:

    How can I use lower letter only like a,b,c?
    i gave 82 for r. when i press with shift+r only it is working. pls give me solution

  • StevieB says:

    //this puts an input textfield on the stage
    //and sets BACKSPACE key to output the string "Do Something"

    var myText:TextField = new TextField();
    myText.type = TextFieldType.INPUT;
    myText.height = 20;
    myText.border = true;
    addChild(myText);

    myText.addEventListener(KeyboardEvent.KEY_DOWN, backspace);
    function backspace(evt:KeyboardEvent):void
    {
    if(evt.keyCode == 8) {
    trace("Do Something");

    } // end IF
    } // end FUNCTION

  • StevieB says:

    //this displays the keyCodes of keys pressed

    var textLabel:TextField = new TextField();
    textLabel.text = "Click inside box and then press any key.";
    addChild(textLabel);
    textLabel.width = 200;
    textLabel.x = 20;
    textLabel.y = 10;
    textLabel.selectable = false;

    var staticText:TextField = new TextField();
    staticText.text = "Keycode Pressed:";
    addChild(staticText);
    staticText.x = 20;
    staticText.y = 40;

    var dynamicText:TextField = new TextField();
    dynamicText.type = TextFieldType.DYNAMIC;
    dynamicText.x = 120;
    dynamicText.y = 40;
    dynamicText.height = 20;
    dynamicText.width = 40;
    dynamicText.border = true;
    addChild(dynamicText);

    stage.addEventListener(KeyboardEvent.KEY_UP, idKey);
    function idKey(evt:KeyboardEvent):void
    {
    var keyString:String = new String(evt.keyCode);
    dynamicText.text = keyString;
    }

Leave a Reply