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

Orientation change Android

New Here ,
Aug 08, 2014 Aug 08, 2014

Copy link to clipboard

Copied

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

TOPICS
Development

Views

209

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