Quantcast
Channel: Adobe Community : Unanswered Discussions - AIR Development
Viewing all articles
Browse latest Browse all 2010

Bug: ORIENTATION_CHANGE event does not fire if start in landscape mode (iOS)

$
0
0

Hi all,

 

I have been testing ORIENTATION_CHANGE, ORIENTATION_CHANGING and RESIZE events across iOS and Android.  Tests done using AIR3.7/Flex4.6.0.

I've been starting the app in 'default' orientation, then rotating it.

I've also started the app in landscpe mode, then rotated it back.

 

Almost all devices work fine (though there are differences in the order of events between iOS and Android) except that, disturbingly, ORIENTATION_CHANGE does not fire on iPod 4th (iOS6.1.3) or iPhone 5 (iOS6.1.4) when starting in landscape, even though ORIENTATION_CHANGING does.  Not sure if it's iOS related or not.  It seems to happen on devices where the springboard doesn't rotate to orientation (i.e. rotating iPad reshuffles the icons on springboard, but rotating the iPhone/iPod does not) - this means that the app rotates just after it is launched.

 

Is this a bug that is likely to be addressed?  Watching for 'ORIENTATION_CHANGE' event is pretty standard behaviour for detecting orientation changes!

 

Here is my test:

 

iOS - start in portrait (iPad1 iOS5.1.1, iPod4th iOS6.1.3, iPhone5 iOS 6.1.4)

     RESIZE

     RESIZE

Now rotate the device left

     ORIENTATION_CHANGING

     RESIZE

     ORIENTATION_CHANGE

 

iPod 4th and iPhone 5 - start landscape before launching app

     RESIZE

     ORIENTATION_CHANGING

     RESIZE

     .... no 'change' event   <--  HERE IS THE ERROR

Now rotate device back to default

     ORIENTATION_CHANGING

     RESIZE

     ORIENTATION_CHANGE

 

iPad 1 - start landscape before launching app

     RESIZE

     RESIZE

Now rotate the device left

     ORIENTATION_CHANGING

     RESIZE

     ORIENTATION_CHANGE

 

And for those that are interested, here is the difference between Andoid (phone only - tablet tests to come) and emulator:

 

Emulator (Flash debug player - start default)

     RESIZE

     RESIZE

Rotate left

     ORIENTATION_CHANGING

     RESIZE

     RESIZE

     ORIENTATION_CHANGE

 

Android Samsung Galaxy S3 - start default

     RESIZE

     RESIZE

Rotate back to default

     ORIENTATION_CHANGING

     ORIENTATION_CHANGE

     RESIZE

 

Android Samsung Galaxy S3 - start landscape

     RESIZE

     RESIZE

Rotate back to default

     ORIENTATION_CHANGING

     ORIENTATION_CHANGE

     RESIZE

 

Here is the test code:

 

package{          import flash.desktop.NativeApplication;          import flash.events.Event;          import flash.display.Sprite;          import flash.display.StageAlign;          import flash.display.StageScaleMode;          import flash.events.StageOrientationEvent;          import flash.text.TextField;          import flash.text.TextFormat;          import flash.ui.Multitouch;          import flash.ui.MultitouchInputMode;            /**           * ...           * @author Peter Vullings           */          publicclass Main extends Sprite {                      private var txt : TextField;                    private var fmt : TextFormat;                      public function Main():void{                              stage.scaleMode = StageScaleMode.NO_SCALE;                              stage.align = StageAlign.TOP_LEFT;                              stage.addEventListener(Event.DEACTIVATE, deactivate);                                // touch or gesture?                              Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;                                // entry point                              fmt = new TextFormat;                              fmt.size = 20;                              fmt.color = 0x000000;                                txt = new TextField();                              txt.defaultTextFormat = fmt;                              txt.multiline = true;                              txt.wordWrap = true;                              txt.width = stage.stageWidth;                              txt.height = stage.stageHeight;                              addChild(txt);                                stage.addEventListener( StageOrientationEvent.ORIENTATION_CHANGING, orientationChanging );                              stage.addEventListener( StageOrientationEvent.ORIENTATION_CHANGE, orientationChange );                              stage.addEventListener( Event.RESIZE, resize );                    }                      private function deactivate(e:Event):void{                              // make sure the app behaves well (or exits) when in background                              //NativeApplication.nativeApplication.exit();                    }                      private function resize( e : Event ):void{                              report('RESIZE');                              report('  stage width:' + stage.stageWidth);                              report('  stage height:' + stage.stageHeight);                              report('  stage orientation:' + stage.orientation);                              report('  device orientation:' + stage.deviceOrientation);                                txt.width = stage.stageWidth;                              txt.height = stage.stageHeight;                    }                      private function orientationChanging( e : StageOrientationEvent ):void{                              report('ORIENTATION CHANGING');                              report('  before orientation:' + e.beforeOrientation);                              report('  after orientation:' + e.afterOrientation);                              report('  stage width:' + stage.stageWidth);                              report('  stage height:' + stage.stageHeight);                              report('  stage orientation:' + stage.orientation);                              report('  device orientation:' + stage.deviceOrientation);                    }                      private function orientationChange( e : StageOrientationEvent ):void{                              report('ORIENTATION CHANGED');                              report('  before orientation:' + e.beforeOrientation);                              report('  after orientation:' + e.afterOrientation);                              report('  stage width:' + stage.stageWidth);                              report('  stage height:' + stage.stageHeight);                              report('  stage orientation:' + stage.orientation);                              report('  device orientation:' + stage.deviceOrientation);                    }                      private function report( s : String ):void{                              trace(s);                              txt.appendText(s + '\n');                    }            }  } 

Viewing all articles
Browse latest Browse all 2010

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>