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

Problem with stage.stageWidth/Height values with Event.ScreenSize in Air 3.9

Explorer ,
Sep 20, 2013 Sep 20, 2013

Copy link to clipboard

Copied

I have just updated from AIR 3.6 to AIR 3.9 and have encoutered some unexpected behavior that is giving me grief when attempting to test on the Desktop.

I've been using the following code to set the appropriate screen resolution for my iOS devices for the last couple of years without any issues. However now after updating from Air 3.6 to Air 3.9 under FB4.6, when the onScreenResize() event fires the values of stage.stageWidth & stage.stageHeight just returns the values that I've specified in the following statement (500, 375), rather than the dimensions for the device that I have selected in FB's "Debug Configurations":

[SWF(backgroundColor="#000000", frameRate="30", width="500", height="375")]

This results in the window size and menu layouts for my app not getting setup correctly, which makes it very difficult to test on the desktop. Under Air 3.6 when onScreenResize() gets called stage.stageWidth & stage.stageHeight return the device dimensions properly. This code still seems to work properly when run on an iOS device, just not on the desktop. Does anyone know why stage.stageWidth & stage.stageHeight no longer return the values that they did under Air 3.6 (and how I can fix/work around this issue)?

Some of the code has been removed to improve readability.

[SWF(backgroundColor="#000000", frameRate="30", width="500", height="375")]

public function MyApp()

{

     stage.align = StageAlign.TOP_LEFT;

     stage.scaleMode = StageScaleMode.NO_BORDER; // StageScaleMode.EXACT_FIT;

     stage.scaleMode = StageScaleMode.NO_SCALE;

     addEventListener(Event.ADDED, initializeApp, false, 0, true);

}

private function initializeApp(event:Event):void

{

     removeEventListener(Event.ADDED, initializeApp);

     stage.addEventListener(Event.RESIZE, onScreenResize, false, 0, true);

}

private function onScreenResize(event:Event):void

{

     if ( stage.stageWidth == 500 && stage.stageHeight == 375 )

     {

          // This is an initial default size event that we don't care about.

          // Seems like there should be a less hacky way to avoid this situation.

          return;

          }

     // Now that we know the device dimensions, create menu layouts and start the app.

     // This no longer gets called as stageWidth/Height are 500/375 above and the function exits.

     setDeviceDimensionsAndStartApp();

}

Thanks.

TOPICS
Development

Views

992

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
Adobe Employee ,
Sep 21, 2013 Sep 21, 2013

Copy link to clipboard

Copied

We are able to reproduce the problem. I request you to open a new bug report on this over at bugbase.adobe.com? Please include sample media. Once the bug has been added would you mind posting back with the URL so that others affected can add their votes and comments?

Regards,

Nimit

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
Explorer ,
Sep 22, 2013 Sep 22, 2013

Copy link to clipboard

Copied

LATEST

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