Copy and paste as "KeyCodeUtil.as", place it under the folder: net / onthewings / utils
/* KeyCodeUtil.as Andy Li ( andy@onthewings.net ) 2009-11-02 */ package net.onthewings.utils { import flash.ui.Keyboard; public class KeyCodeUtil { /* The below codes is used for generating KEYCODES. Some formating is needed to be done by hand after getting the outputStr. var outputStr:String = ""; function onPress(evt:KeyboardEvent):void { outputStr += "'" + evt.charCode + "':" + evt.keyCode + ", //"+String.fromCharCode(evt.charCode)+"\n"; } */ static public const KEYCODES:Object = { 27: 27, //esc 96: 192, //` 49: 49, //1 50: 50, //2 51: 51, //3 52: 52, //4 53: 53, //5 54: 54, //6 55: 55, //7 56: 56, //8 57: 57, //9 48: 48, //0 45: 189, //- 61: 187, //= 8: 8, //backspace 9: 9, //tab 113: 81, //q 119: 87, //w 101: 69, //e 114: 82, //r 116: 84, //t 121: 89, //y 117: 85, //u 105: 73, //i 111: 79, //o 112: 80, //p 91: 219, //[ 93: 221, //] 92: 220, //\ 97: 65, //a 115: 83, //s 100: 68, //d 102: 70, //f 103: 71, //g 104: 72, //h 106: 74, //j 107: 75, //k 108: 76, //l 59: 186, //; 39: 222, //' 13: 13, //enter 122: 90, //z 120: 88, //x 99: 67, //c 118: 86, //v 98: 66, //b 110: 78, //n 109: 77, //m 44: 188, //, 46: 190, //. 47: 191, /// 32: 32, //space 127: 46, //delete 126: 192, //~ 33: 49, //! 64: 50, //@ 35: 51, //