title: Properly preventing orientation change in Flex Mobile app
body: <p>Is anyone able to actually make it work properly in Flex SDK 4.6?</p>
  
  <p>Here's a short snippet :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          addedToStage="onAddedToStage(event)"
          title="Title"&gt;
      &lt;fx:Script&gt;
          &lt;![CDATA[  
              private function onAddedToStage(event:Event):void { 
                  if (stage.autoOrients) {
                      stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChanging, false, 0, true);
                  }
              }
  
              private function orientationChanging(event:StageOrientationEvent):void {
                  if (event.afterOrientation == StageOrientation.DEFAULT || event.afterOrientation == StageOrientation.UPSIDE_DOWN) {
                      event.preventDefault(); 
                  }     
              } 
          ]]&gt;
      &lt;/fx:Script&gt;
  &lt;/s:View&gt;
  </code></pre>
  
  <p>What I'm trying to achieve is to support Landscape mode in both orientations, so if user turns the device 180 degress, the screen should also rotate. But there should be no action at all, when user rotates the device to one of portrait orientations. Instead, I'm seeing width changes to navigator action bar and sometimes content in portrait orientations, so apparently preventing the event is not enough.  I'm using the "official" way Adobe suggests, but the problem is that it's not working very well. Granted, the stage does not change, but it seems that there's something firing in navigator anyway, since you can see the action bar width changing.</p>
  
  <p>I had some success with explicitly setting layoutbounds to fixed width in handler method - this prevents changing the actionbar width, but it's only a temporary solution - if the view is a subject to a transition, or some other redraw - it will again render with bad sizes. As if there was something below that was telling it that it's in portrait mode, even though I'm trying to prevent it.</p>
  
  <p>Before you detonate with some silly ideas like "autoOrient = false", don't. It's clearly not a solution for this problem. Obviously it's a bug with Flex SDK - did anyone find a way to fix it or a stable workaround? </p>
  
  <p>EDIT: apparently others bumped into similar issue:<br>
  - <a href="http://forums.adobe.com/message/3969531" rel="nofollow noreferrer">http://forums.adobe.com/message/3969531</a> (the main topic is about something else, but read magic robots's comment)<br>
  - <a href="http://forums.adobe.com/message/4130972" rel="nofollow noreferrer">http://forums.adobe.com/message/4130972</a>  </p>