友情链接


真我闪博

http://ntt.cc/2010/05/03/flash-key-control-codes-define-class.html


http://nwhy.org/key-control-codes-define-class.html

先来看下这个:http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/ui/Keyboard.html
这里边是AIR里的键盘对应类,不过很奇怪的是有些STRING_F32 : String = "?"的格式
F32算是保留键,不过STRING_DOWNARROW : String = "?"这个就很奇怪了,这个是啥键,不是小键盘的向下键?

Flash就没这么好命了,你只能自己写键盘对应的键值,不过有好人把对应键整理了出来,原地址是在这里:http://ntt.cc/2010/05/03/flash-key-control-codes-define-class.html

Copy下:

package {
	public class KeyControlCode {
		public static  var KEY_BACKSPACE:uint=8;
		public static  var KEY_TAB:uint=9;
		public static  var KEY_ENTER:uint=13;
		public static  var KEY_SHIFT:uint=16;
		public static  var KEY_CONTROL:uint=17;
		public static  var KEY_PAUSE:uint=19;
		public static  var KEY_CAPSLOCK:uint=20;
		public static  var KEY_ESC:uint=27;
		public static  var KEY_SPACEBAR:uint=32;
		public static  var KEY_PAGEUP:uint=33;
		public static  var KEY_PAGEDOWN:uint=34;
		public static  var KEY_END:uint=35;
		public static  var KEY_HOME:uint=36;
		public static  var KEY_LEFT:uint=37;
		public static  var KEY_UP:uint=38;
		public static  var KEY_RIGHT:uint=39;
		public static  var KEY_DOWN:uint=40;
		public static  var KEY_INSERT:uint=45;
		public static  var KEY_DELETE:uint=46;
		public static  var KEY_0:uint=48;
		public static  var KEY_1:uint=49;
		public static  var KEY_2:uint=50;
		public static  var KEY_3:uint=51;
		public static  var KEY_4:uint=52;
		public static  var KEY_5:uint=53;
		public static  var KEY_6:uint=54;
		public static  var KEY_7:uint=55;
		public static  var KEY_8:uint=56;
		public static  var KEY_9:uint=57;
		public static  var KEY_A:uint=65;
		public static  var KEY_B:uint=66;
		public static  var KEY_C:uint=67;
		public static  var KEY_D:uint=68;
		public static  var KEY_E:uint=69;
		public static  var KEY_F:uint=70;
		public static  var KEY_G:uint=71;
		public static  var KEY_H:uint=72;
		public static  var KEY_I:uint=73;
		public static  var KEY_J:uint=74;
		public static  var KEY_K:uint=75;
		public static  var KEY_L:uint=76;
		public static  var KEY_M:uint=77;
		public static  var KEY_N:uint=78;
		public static  var KEY_O:uint=79;
		public static  var KEY_P:uint=80;
		public static  var KEY_Q:uint=81;
		public static  var KEY_R:uint=82;
		public static  var KEY_S:uint=83;
		public static  var KEY_T:uint=84;
		public static  var KEY_U:uint=85;
		public static  var KEY_V:uint=86;
		public static  var KEY_W:uint=87;
		public static  var KEY_X:uint=88;
		public static  var KEY_Y:uint=89;
		public static  var KEY_Z:uint=90;
		public static  var KEY_NUMPAD_0:uint=96;
		public static  var KEY_NUMPAD_1:uint=97;
		public static  var KEY_NUMPAD_2:uint=98;
		public static  var KEY_NUMPAD_3:uint=99;
		public static  var KEY_NUMPAD_4:uint=100;
		public static  var KEY_NUMPAD_5:uint=101;
		public static  var KEY_NUMPAD_6:uint=102;
		public static  var KEY_NUMPAD_7:uint=103;
		public static  var KEY_NUMPAD_8:uint=104;
		public static  var KEY_NUMPAD_9:uint=105;
		public static  var KEY_NUMPAD_MULTIPLY:uint=106;
		public static  var KEY_PLUS:uint=107;
		public static  var KEY_SUBTRACT:uint=109;
		public static  var KEY_DOT:uint=110;
		public static  var KEY_DIVISION:uint=111;
		public static  var KEY_F1:uint=112;
		public static  var KEY_F2:uint=113;
		public static  var KEY_F3:uint=114;
		public static  var KEY_F4:uint=115;
		public static  var KEY_F5:uint=116;
		public static  var KEY_F6:uint=117;
		public static  var KEY_F7:uint=118;
		public static  var KEY_F8:uint=119;
		public static  var KEY_F9:uint=120;
		public static  var KEY_F11:uint=122;
		public static  var KEY_F12:uint=123;
		public static  var KEY_F13:uint=124;
		public static  var KEY_F14:uint=125;
		public static  var KEY_F15:uint=126;
		public static  var KEY_NUMLOCK:uint=144;
		public static  var KEY_SCROLLLOCK:uint=145;
		public static  var KEY_SEMICOLON:uint=186;
		public static  var KEY_EQUAL:uint=187;
		public static  var KEY_COMMA:uint=188;
		public static  var KEY_MINUS:uint=189;
		public static  var KEY_PERIOD:uint=190;
		public static  var KEY_SLASH:uint=191;
		public static  var KEY_BACKQUOTE:uint=192;
		public static  var KEY_LEFTBRACKET:uint=219;
		public static  var KEY_BACKSLASH:uint=220;
		public static  var KEY_RIGHTBRACKET:uint=221;
		public static  var KEY_QUOTE:uint=222;
	}
}

用法很简单,以前需要记键值,现在就用这里的键名就好了~感谢整理出来的那哥们。

posted on 2011-04-11 17:04  xbg  阅读(566)  评论(0编辑  收藏  举报