Adobe AIR - 全屏/显示

Adobe AIR - Fullscreen / Display

Windows 计算机 运行 AIR.

每天晚上,教育显示屏都会关闭。电脑一直开着。

在某些显示器上,当他们在早上打开它们时,屏幕分辨率来回变化几次,从 1920 x 1080 到 1024 x 768,然后再回到 1920 x 1080。

当由于某种原因发生这种情况时,AIR 应用程序会崩溃并保持在 1024 x 768,这不会占用全屏,您可以看到桌面。我们必须手动重新启动 AIR 应用程序。

有没有办法在发生这种情况时检测到并返回强制全屏显示?

提前感谢您提出任何建议。

如果您使用的是最大化的 window,您可以在舞台上监听 Event.RESIZE(在 window 调整大小时调度),或者监听原生 windows displayStateChangeresize 事件。

如果您正在使用 FULL_SCREEN(或 FULL_SCREEN_INTERACTIVE)显示状态,您可以侦听 FullScreenEvent.FULL_SCREEN 事件以了解它何时发生变化。

以下是您可以尝试的一些示例:

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