• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Enforce full screen mode

New Here ,
Apr 25, 2014 Apr 25, 2014

Copy link to clipboard

Copied

For my app I run the following at startup to show the window as fullscreen:

~~~

window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE;

~~~

And then for the activate and deactivate states I do:

~~~

window.nativeWindow.addEventListener(air.Event.ACTIVATE, function() {

    window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE;

    window.nativeWindow.visible = true;

});

window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

    window.nativeWindow.visible = false;

});

~~~

So the idea is that when the window is deactivated or minimized it will hide the window. And then reshow it on focus or maximize and make the window fullsceen again.

The problems are:

1.) The window never becomes visible again when I ALT-Tab or CMD-Tab to the window after leaving the window. It also doesn't change the visibility states when minimizing or maximizing the window but DOES fire the activate and deactive event. Wonder if this is because of the Mac OS X animation on minimize?

2.) If I comment out the visibility code to test the fullscreen code. The activate event seems to run as soon as I minimze the window so the window becomes fullscreen again...

Any ideas on how to fix these two issues? Is there an alternate to visible to hide or show the window? And why is the activate event being fired when I minimize the window?

TOPICS
Development

Views

437

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 30, 2014 Apr 30, 2014

Copy link to clipboard

Copied

LATEST

I havent done any testing yet but your above code looks incorrect in some areas. But until I get home and can do some testing, here is what I know. I didnt think that the ACTIVATE event on NativeWindow's should happen unless you called the activate() method specifically, but I could be wrong on that. For testing between ALT(Cmd)+Tab, you should listen for the ACTIVATE and DEACTIVATE on the NativeApplication.nativeApplication property.

So, for example:

     NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onAppReceiveFocus);

     NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onAppLoseFocus);

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApplication.h...

For minimizing, you should listen for the displayStateChange event in NativeWindow. That event fires after a display state change has happened and will tell you if the window is minimized, maximized, or normal.

Example:

     stage.nativeWindow.addEventListener(Event.DISPLAY_STATE_CHANGE, onDisplayStateChange);

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/NativeWindow.html#e...

The "window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE;" code looks correct assuming "window" is a variable that is a reference to an active window.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines