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

Help with orientation problem on iPad only app that supports both orientations

Community Beginner ,
Oct 10, 2012 Oct 10, 2012

Copy link to clipboard

Copied

My app supports both orientations adnd I have just noticed a problem if you rotate the app whilst the default.png image is being displayed.

If I launch my app with the device in a particular orientation it works fine

If I rotate the app whilst the default.png image is being displayed, it displays the content in the wrong orientation.

So for example if I launch the app with the device held in portrait mode. The correct default image appears, Whilst this is on screen I rotate to landscape and then the content displays but instead of being the landscape orientation graphics, it is the portrait.

If I then rotate the app again it resolves itself but it is not a very professional start to the app so I would like to fix this.

I have 2 keyframes for my content with the labels "portrait" and "landscape" and use the code

<code>

stage.addEventListener( StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging );

function onOrientationChanging( event:StageOrientationEvent ):void {

             if(event.afterOrientation == StageOrientation.ROTATED_LEFT || event.afterOrientation == StageOrientation.ROTATED_RIGHT ) {

                             -- Display Landscape Graphics Layout

      }

if(event.afterOrientation == StageOrientation.UPSIDE_DOWN || event.afterOrientation == StageOrientation.DEFAULT ) {

                    -- Display Portrait Graphics Layout

}

}

I also call the following code on start up

if (stage.orientation == StageOrientation.DEFAULT || stage.orientation == StageOrientation.UPSIDE_DOWN) {

   -- Display Portrait Graphics Layout

          }

          if (stage.orientation == StageOrientation.ROTATED_RIGHT || stage.orientation == StageOrientation.ROTATED_LEFT) {

              -- Display Landscape Graphics Layout

          }

</code>

I suspect the problem is due to the value of stage.orientation not being available initially but do not know what the solution is to get this info in this situation, Perhaps there is some alternative code I can use initially to determine what orientation graphics should be displayed?

Here are my publishing settings.

Aspect Ratio: Auto

Full Screen checked

Auto Orientation checked

Render Mode auto

Device iPad

Resolution standard

Air 3.4

Flash CS6

Thanks in advance

TOPICS
Development

Views

947

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
Oct 10, 2012 Oct 10, 2012

Copy link to clipboard

Copied

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
Community Beginner ,
Oct 10, 2012 Oct 10, 2012

Copy link to clipboard

Copied

I suspect not as on that page it states:

The deviceOrientation is not always available when your application first starts up or when the device is lying flat.

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
Adobe Employee ,
Oct 10, 2012 Oct 10, 2012

Copy link to clipboard

Copied

LATEST

AS code within the application is executed once application is done with displaying the launch image. In the application constructor, you can get the correct value of stage.orientation but stage.deviceOrientation might return unknown.

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