Skip to main content
Participating Frequently
March 20, 2013
Question

AIR 3.5 Fullscreen StageScaleMode.SHOW_ALL bugg

  • March 20, 2013
  • 6 replies
  • 1015 views

Hi,

When I try to run this simple application with a button to toggle fullscreen on/off, the button itself is supposed to stay centered in the middle of the screen but it doesn't.

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

    xmlns:s="library://ns.adobe.com/flex/spark"

    xmlns:mx="library://ns.adobe.com/flex/mx"

    width="1280"

    height="800"

    applicationComplete="stage.scaleMode = StageScaleMode.SHOW_ALL"

    >

    <fx:Script>

        <![CDATA[

           

            private function toggleFullscreen():void

            {

                if (stage.displayState == StageDisplayState.NORMAL)

                    stage.displayState = StageDisplayState.FULL_SCREEN;

                else

                    stage.displayState = StageDisplayState.NORMAL;

            }

           

        ]]>

    </fx:Script>

   

    <s:Button label="Toggle Fullscreen" verticalCenter="0" horizontalCenter="0" click="toggleFullscreen()" />

   

</s:WindowedApplication>

Am I doing something wrong?

Thank you for your help

This topic has been closed for replies.

6 replies

chris.campbell
Legend
March 20, 2013

Try this code to see if it helps:

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                                     xmlns:s="library://ns.adobe.com/flex/spark"

                                                     xmlns:mx="library://ns.adobe.com/flex/mx"

                                                     width="1280"

                                                     height="800"

                                                     applicationComplete="init()"

                                                     >

          <fx:Script>

                    <![CDATA[

 

                              private function init():void

                              {

                                        stage.align=StageAlign.TOP_LEFT;

                                        stage.scaleMode=StageScaleMode.NO_SCALE;

 

                                        stage.addEventListener(Event.RESIZE, handleResize);

                                        stage.dispatchEvent(new Event(Event.RESIZE));

                              }

 

                              private function handleResize(e:Event):void

                              {

                                        btToggleFullscreen.x = stage.stageWidth/2 - btToggleFullscreen.width/2;

                                        btToggleFullscreen.y = stage.stageHeight/2 - btToggleFullscreen.height/2;

                              }

 

                              private function toggleFullscreen():void

                              {

                                        if (stage.displayState == StageDisplayState.NORMAL)

                                                  stage.displayState = StageDisplayState.FULL_SCREEN;

                                        else

                                                  stage.displayState = StageDisplayState.NORMAL;

                              }

 

                    ]]>

          </fx:Script>

 

          <s:Button id="btToggleFullscreen" label="Toggle Fullscreen" click="toggleFullscreen()" />

 

</s:WindowedApplication>

Participating Frequently
March 20, 2013

Hi Chris,

Unfortunately, it doesn't help as I want the application to scale proportionaly in order to occupy all available space. That is why I put SHOW_ALL instead of NO_SCALE.

Is this an AIR bug?

When I read SHOW_ALL description, it should do what I need, but somehow it doesn't. If there is another way of achieving this, I'm willing to try.

Thank you helping

chris.campbell
Legend
March 21, 2013

You can definitely add a bug report as I'm far from an expert in this area.  However, some google searches with show_all and air tell me that this is a tricky subject and one that's been around for a long time.  Unless this is a recent break, the likelihood of this being addressed is slim.