Skip to main content
Participating Frequently
December 18, 2012
Question

StageOrientation issues

  • December 18, 2012
  • 3 replies
  • 933 views

Hello,

I have dial with Adobe AIR on Android.

When the application starts, it tries to recognize the current stage orientation to apply proper layout.

Also it uses StageOrientationEvent.ORIENTATION_CHANGE event to properly reflect when the device's orientation changes.

The main issue is that the values of StageOrientation enum are not absolute (StageOrientation.DEFAULT...).

On different devices those (StageOrientation.DEFAULT, StageOrientation.ROTATED_LEFT etc.) may mean different things.

For instance.

1. On Asus Nexus (Android 4.1.2) the StageOrientation.DEFAULT is mapped to portrait orientation.

2. On Texet TM-7025 (Android 4.0) the StageOrientation.DEFAULT is mapped to landscape orientation.

And...

It were not an issue if in StageOrientationEvent.ORIENTATION_CHANGE handler,

the stage dimensions would properly updated.

In this way I would be able to use this approach

http://help.adobe.com/en_US/as3/dev/WS901d38e593cd1bac40357fa212caafb9dd0-8000.html.

But, actually, it dosn't work due to sometimes the stageWidth and stageHeight have values as

before the StageOrientationEvent.ORIENTATION_CHANGE event. ((...

THE QUESTION: Is there an easy (correct) way to make this work properly?

Thanx in advance.

This topic has been closed for replies.

3 replies

Mark.fromOP
Inspiring
January 7, 2013

Worst case scenario is offer the users an option to pick between the 4 possible options on start up and save it to a shared object, its a little inconvenient but its a one time process and will give them the proper app experience regarding of device.

Colin Holgate
Inspiring
December 18, 2012

You should read about the StageOrientationEvent.ORIENTATION_CHANGING event, that is usually better, you get a headstart on the fact that the orientation is chaining.

You're right about different devices. I think the general rule is that all iOS devices have Portrait as Default, but with Android tablets have Landscape as Default, and phones have Portrait as Default.

I'm not 100 percent certain of this, but suspect it to be the case, that there's a relationship between Capabilities.screenResolutionX and Default. Try a test, to see if Capabilities.screenResolutionX is less than Capabilities.screenResolutionY. If it is, and if I'm right, then Portrait is Default. Otherwise Landscape is Default.

You can also just test the orientation when you start up, and compare what it claims to be against the stage size. Again you would then know whether Default is Portrait or Landscape.

4xyfenixAuthor
Participating Frequently
December 19, 2012

Thank you Colin, I did as you said: You can also just test the orientation when you start up