简体   繁体   English

Adobe AIR - 全屏/显示

[英]Adobe AIR - Fullscreen / Display

Windows computer running AIR. Windows计算机运行AIR。

Every night the educational displays get turned off. 每天晚上教育显示都会被关闭。 The computers stay on. 电脑继续使用。

On certain displays when they turn them on in the morning the screen resolution goes back and forth a few times starting at 1920 x 1080 then to 1024 x 768 then back to 1920 x 1080. 在某些显示器上,当他们在早上打开它们时,屏幕分辨率来回几次,从1920 x 1080开始,然后到1024 x 768,然后再回到1920 x 1080。

When this happens for some reason the AIR app freaks out and stays at 1024 x 768 which doesn't take up the fullscreen and you can see the desktop. 当由于某种原因发生这种情况时,AIR应用程序会突然出现并保持在1024 x 768,这不会占用全屏,您可以看到桌面。 We have to manually relaunch the AIR app. 我们必须手动重新启动AIR应用程序。

Is there a way when this happens we can detect and go back to force Fullscreen? 有没有办法,当这种情况发生时我们可以检测并返回强制全屏?

Thanks in advance for any suggestions. 在此先感谢您的任何建议。

If you are using a maximized window, you can listen for Event.RESIZE on the stage (dispatched when the window get's resized), and or listen for the native windows displayStateChange or resize events. 如果您使用的是最大化窗口,则可以在舞台上侦听Event.RESIZE (在调整窗口大小时调度),或者侦听本机窗口displayStateChangeresize事件。

If you are using the FULL_SCREEN (or FULL_SCREEN_INTERACTIVE) display state, you can listen for the FullScreenEvent.FULL_SCREEN event to know when that has changed. 如果您正在使用FULL_SCREEN(或FULL_SCREEN_INTERACTIVE)显示状态,则可以侦听FullScreenEvent.FULL_SCREEN事件以了解何时更改。

Here is an example of a few things you can try: 以下是您可以尝试的一些示例:

//in your document class or main timeline, listen for the following events:

stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, windowResized);
//the above will fire anytime the window size changes, Really this is all you need as this event will fire when the window display state changes as well.

stage.nativeWindow.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGE, windowResized);
//the above will fire anytime the window state changes - eg. Maximized/Restore/Minimize.  This likely won't trigger on a resolution change, but I've included it anyway

stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullscreenChange);
//the above will fire whenever you enter or leave fullscreen mode (stage.displayState)

private function windowResized(e:Event):void {
    //re-maximize the window
    stage.nativeWindow.maximize();

    //OR Go to full screen mode
    stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

private function fullscreenChange(e:FullScreenEvent):void {
    if (!e.fullScreen) {
        //in half a second, go back to full screen
        flash.utils.setTimeout(goFullScreen, 500);
    }
}

private function goFullScreen():void {
    stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM