Flex 自动获取焦点 监听全局键盘事件

在mxml里监听addedToStage事件

protected function application1_addedToStageHandler(event:Event):void
            {
                this.stage.focus=this
                this.stage.addEventListener(KeyboardEvent.KEY_DOWN, application1_keyDownHandler);
            }

在嵌入SWF的html里面加入如下的功能:

<body onload="document.getElementById('swf id').focus()"> 

 或者可以修改index.template.html

<body onload="document.getElementById('${application}').focus()">
原文地址:https://www.cnblogs.com/ddw1997/p/3411442.html