使用全屏视频从全屏 esc 最小化整个应用程序 [英] esc from fullscreen using video in full screen minimizes whole app in flex

查看:43
本文介绍了使用全屏视频从全屏 esc 最小化整个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打算在全屏模式下运行的应用程序.为了防止它退出全屏,我做了:

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();
    }
}

这可以防止应用退出全屏,但我的应用有一个视频播放器,可以选择全屏播放视频,然后当我按 esc 时,整个应用和视频都会变小.

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.

提前致谢!

推荐答案

您可以监听 FullScreenEvent 并设置 stage.displayState 以在调度 FullScreenEvent.FULL_SCREEN 时返回全屏.

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;
}

这篇关于使用全屏视频从全屏 esc 最小化整个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆