Skip to main content
Participant
August 9, 2014
Question

Orientation change Android

  • August 9, 2014
  • 0 replies
  • 236 views

Hi, I have to say It's been a while i'm stuck on this problem and I'm about to disable orientation change for good.

This post is my bottle in the sea !

So I'll decribe my problem very shortly and clearly.

I'm building my first Android APP with Flash cs6 and Air for Android SDK V 13.0.0.111

My project properties (manifest) is set to Auto orientation, Auto Aspect Ratio.

I'm using the event to trigger my project adaptations --> StageOrientationEvent.ORIENTATION_CHANGE

When the stage flip, I gotoAndPlay("landscape or portrait") accordingly.

I've tried many codes on the web, but i'm always facing the same problem.

My event triggers just before the stage really flips. So I end up doing gotoAndPlay("landscape or portrait") before it is really required. But in the end in kinda works.
I think that using auto orientation will always leave my in that situation and I'm looking for your help.


Listen to this event to trigger my changeHandler function


mainC.racine.stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, changeHandler);


function changeHandler(e:StageOrientationEvent):void

  { 

       if(e.afterOrientation)

       {

             if(mainC.racine.stage.orientation == StageOrientation.DEFAULT)

            {
               mainC.racine.debug.text="landscape"; 
               mainC.racine.navA[currentView].gotoAndStop(2);

         

            }

            else if(mainC.racine.stage.orientation == StageOrientation.ROTATED_RIGHT ||  mainC.racine.stage.orientation == StageOrientation.ROTATED_LEFT)

            {

                 mainC.racine.debug.text="portrait";  

                mainC.racine.navA[currentView].gotoAndStop(1); 

            }  
      }  

  }

Thank you for considering helping me.

Sébastien

This topic has been closed for replies.