title: Flash Builder 4.6 Mobile Orientation
body: <p>I'm working with FlashBuilder 4.6 to develop Android app.
  In the application there is a requirement of setting some values when device orientation changes. i.e. setting the values when the screen/device orientation changes from Landscape to Portrait and vice-verse.</p>
  
  <p>Although Initially my application has <strong>LandScape</strong> orientation. And this requirement is on specific view.</p>
  
  <p>I want every time when the screen/device orientation changes the values must be set there.
  I am not getting the desired result.<br>
  Please guide me and tell me if I am at wrong in code or how can i achieve this.</p>
  
  <pre><code>&lt;s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" title="{data}" 
          xmlns:mx="library://ns.adobe.com/flex/mx"
          viewActivate="view1_viewActivateHandler(event)"
          creationComplete="view1_creationCompleteHandler(event)"&gt;
  &lt;fx:Script&gt;
     &lt;![CDATA[
  protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
  {
      if(Accelerometer.isSupported)
      {
      accl = new Accelerometer();
          accl.addEventListener(AccelerometerEvent.UPDATE,update);                //accl.addEventListener(AccelerometerEvent.UPDATE,adjustImage);
      }
  }
  private function update(event:AccelerometerEvent):void
  {
       this.stage.autoOrients = true;
       //in the below line I am attaching StageOrienationEvent that will adjust the 
       //values.
       stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE,adjust);
  }
  private function adjust(event:StageOrientationEvent):void
  {
       if(event.afterOrientation == StageOrientation.ROTATED_LEFT)
       {
      testVal.text ="After OR is LEFT";
       }
       else if(event.afterOrientation == StageOrientation.ROTATED_RIGHT)
       {
      testVal.text ="After OR is RIGHT"; 
       }
       else if(StageAspectRatio.LANDSCAPE)
       {
      testVal.text ="StageAspectRatio is Landscape";
       }
       else if(StageAspectRatio.PORTRAIT)
       {
      testVal.text="StageAspectRatio is  Portrait";
       }
  }
  
  &lt;/fx:Script&gt;
  </code></pre>
  
  <p>Thanks.</p>