1 Reply Latest reply on Nov 8, 2011 3:54 AM by flexercised

    View resizes when it shouldn't

    flexercised Level 3

      http://www.adobe.com/devnet/flex/articles/mobile-development-flex-flashbuilder.html#articl econtentAdobe_numberedheader_1


      On this page it says: "When the user rotates the screen between portrait and landscape orientations, the View is automatically resized by default to the appropriate aspect ratio."

      How can this be prevented i.e. make the view keep the same size?


      If you use the screen orientation apis to confine the app to 2 orientations (rotated left and right), you can prevent the app rotating but the view resizes anyway.

        • 1. Re: View resizes when it shouldn't
          flexercised Level 3

          Try this:


          <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                  xmlns:s="library://ns.adobe.com/flex/spark" title="Home"





                  import flash.display.StageOrientation;

                  import flash.events.StageOrientationEvent;


                  private function initView():void {

                     stage.addEventListener( StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging );



                  private function onOrientationChanging( event:StageOrientationEvent ):void {

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






                  <s:Rect height="100%" width="100%">

                      <s:fill><s:SolidColor color="red" /></s:fill>



              <s:Label text="Hello World" horizontalCenter="0" verticalCenter="0"/>



          In the app xml:





          Start the app on the ipad in landscape orientation. Turn it 90°. The red shape and actionbar do not fill the screen any more.

          Any solution?