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

disable Auto Orientation only in a specific frame!

Contributor ,
Feb 13, 2014 Feb 13, 2014

Hi there! 

I appreciate if you please guide me with your experience in Mobile App design.

My App contains 5 frames of data (movieclips), that each frame has 2 designs:

1- Stand mode design    (portrait)

2- Wide mode design     (landscape)

So far it works great and I have published my App both on Google Play and Apple Store.

Frames structure is as follows:

frame   1            Loads External Data

frames 2-6         Each frame contains 1 MovieClip designed based on mobile "Stand mode"

frames 22-26     Each frame contains 1 MovieClip designed based on mobile "Wide mode"

(Example: contents of frame 2 and 22 are the same, also 3 & 23 ... 6 & 26)
(frame 2 is STAND design, 22 is WIDE design, and so on)

In "Air Setting Dialoge", I have selected aspect ratio "Auto" and "Auto orientation".

And I have this code in Frame 1 to do the rotation trick:

stage.addEventListener(Event.RESIZE, resizeLayout);

 

function resizeLayout(e:Event):void

{

               setPosition();

}

function setPosition():void

{

        //Phone turned from "Wide" to "Stand"

               if (stage.stageWidth < stage.stageHeight)

               {

                              //App is now in "Wide" mode - means between frame 22 to 26

                              if (currentFrame>20) 

                              {

                                             //go to the same position of App but in "Stand" mode

                                             gotoAndStop(currentFrame - 20);

                              }

               }

               else

               {

                              //Phone turned from "Stand" to "Wide"

                              if (currentFrame<20)

                                   {

                    //go to the same position of App but in "Wide" mode 

                     gotoAndStop(currentFrame + 20);

                                   }

                         }

}

Well, and finally my question:

1- Is this way I have programed my App to rotate, a proper approach?!

      (in this way I can easily arrange objects on screen and also position them based on math calculations)

2- If I want to disable auto rotation only when app reaches specific frames, what should I do??

   (for example I want the app Not to auto oriente in Frame 6 and 26., but it rotates in other frames)

Hope it was not confusing and I cant wait to check out your valuable guidance!

All the best and thanks a lot for your time.

TOPICS
ActionScript
351
Translate
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

correct answers 1 Correct answer

Contributor , Feb 13, 2014 Feb 13, 2014

Hi there all!!

Still I have no answer for my question No1, BUT I could find my answer to the 2nd question and here it is for your kind notice:

Special thanks to Daniel Dura

http://www.adobe.com/devnet/flash/articles/screen_orientation_apis.html

I just added this code to my first Frame:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging);

function onOrientationChanging(event:StageOrientationEvent ):void

{

          if (currentFrame == 6 || currentFrame == 26)

      

...
Translate
Contributor ,
Feb 13, 2014 Feb 13, 2014
LATEST

Hi there all!!

Still I have no answer for my question No1, BUT I could find my answer to the 2nd question and here it is for your kind notice:

Special thanks to Daniel Dura

http://www.adobe.com/devnet/flash/articles/screen_orientation_apis.html

I just added this code to my first Frame:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging);

function onOrientationChanging(event:StageOrientationEvent ):void

{

          if (currentFrame == 6 || currentFrame == 26)

          {

                    event.preventDefault();

          }

}

Translate
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