使用Actionscript编写获得键盘字节码:
package {
import flash.display.Sprite;
import fl.controls.TextInput;
import flash.events.KeyboardEvent;
public class exam1 extends Sprite {
var txt:TextInput=new TextInput();
public function exam1() {
/*graphics.lineStyle(1,0,1);
for(var i:int=0;i<100;i++)fds
{
graphics.lineTo(Math.random()*400,Math.random()*400);
}
trace("hello");
*/
stage.focus=this;
txt.move(200,25);
txt.setSize(200,25);
addChild(txt);
this.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDn);
}
public function onKeyDn(event:KeyboardEvent):void {
trace("key down: "+event.charCode); //event.charCode字节码
}
}
}