How do I set the Flex Air app to full screen?

I have an Air Application in Flex designed for 1280x800 that I would like to stretch to run full screen on a 1920x1200 monitor.

I read this article: http://blogs.adobe.com/aharui/2008/01/flex_and_scalemodes.html and tried it, but it only increases the top left corner (as pointed out in the article).

I am working with WindowedApplication (shown below) which contains a View (called MasterView) which contains all the different layout elements.

Any suggestions?

My application (in short) looks like this:

<mx:WindowedApplication 
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    width="100%" height="100%"
    horizontalScrollPolicy="off"
    verticalScrollPolicy="off"
    clipContent="false" 
    windowComplete="goFullscreen()" 
    >

private function goFullscreen():void
{                                   
    Mouse.hide();       

    this.stage.scaleMode = StageScaleMode.EXACT_FIT;
    this.stage.align = StageAlign.TOP_LEFT;
    this.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

    try
    {   
        showStatusBar = false;
        removeChild(statusBar);
    }
    catch (err:Error)
    { }

    root.stage.addEventListener(KeyboardEvent.KEY_DOWN, switchFullScreen)               
}

</mx:WindowedApplication>

      

Thanks, Gab

+2


source to share


3 answers


Finally, we found out that the best solution is to manually set the scaling factor. So by determining the width of the screen / viewport and figuring out how this scales to the size of our application, we solved this problem.



0


source


Do you want to go full screen or just enlarge the window? You can do the latter by calling:

this.nativeWindow.maximize();

      

And by doing something full screen, you don't need everything else you have. You just need to call



  this.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

      

Do what you want. Doesn't this work? What does the screen look like when this API is called?

= Ryan

+5


source


I also found this to work.

public function goFullScreen($fullScreen:Boolean){
        if($fullScreen){
            myStage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
            myStage.scaleMode = StageScaleMode.EXACT_FIT;               
        } else {
            myStage.displayState = StageDisplayState.NORMAL;
        }

    }

      

+2


source







All Articles