esc from fullscreen using video in full screen minimizes whole app in flex

本小妞迷上赌 提交于 2019-12-11 20:30:08

问题


I have an application intended to run in full screen mode. In order to prevent it from getting out of full screen I did:

protected function windowedapplication_preinitializeHandler(event:FlexEvent):void
{
     nativeWindow.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
     nativeWindow.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

protected function onKeyDown(event:KeyboardEvent):void
{
   if (event.keyCode == 27)
   {
      event.preventDefault();
    }
}

That prevents the app getting out of full screen but my app has a video player with an option to go full-screen with the video and at that point when i press esc the whole app and the video come to smaller size.

Thanks in advance!


回答1:


You couldn't prevent ESC key to exit from full screen mode. This is security issue.




回答2:


You can listen for the FullScreenEvent and set the stage.displayState to return back to full screen when FullScreenEvent.FULL_SCREEN is dispatched.

This way, the app will change back to full screen even when the user clicks the full screen button to exit full screen mode in the video player.

private function onApplicationComplete(event:Event):void{

      stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
      stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenChange);

}

private function onFullScreenChange(event:FullScreenEvent):void{

      stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}


来源:https://stackoverflow.com/questions/11744017/esc-from-fullscreen-using-video-in-full-screen-minimizes-whole-app-in-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!