package
{
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    import flash.events.Event;
    
    public class Main extends Sprite
    {    
        private var flag:Boolean = new Boolean();
        public function Main():void
        {
            stage.addEventListener(KeyboardEvent.KEY_DOWN, a);
            stage.addEventListener(KeyboardEvent.KEY_UP,b);
        }
        private function a(evt:KeyboardEvent):void
        {
            trace("点击键盘的KEY数字代码: "+evt.keyCode);
        }
        private function b(evt:KeyboardEvent):void
        {
            trace("弹起键盘的KEY数字代码: "+evt.keyCode);
        }
    }
    
    
}

相关文章:

  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
  • 2022-01-03
  • 2021-11-22
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-08-30
  • 2021-05-24
相关资源
相似解决方案