I'm testing my starling application on iPhone 4, I suspect this is happening because of the obsolete IOS version.
package { import flash.events.Event; import flash.events.StageOrientationEvent; import flash.display.Sprite; public class Startup extends Sprite { public function Startup():void { addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); } private function onAddedToStage(e:Event):void { removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangeListener); } private function orientationChangeListener(e:StageOrientationEvent):void { Debug.write("orientation: " + stage.orientation); //Never called } } }
application.xml has autoOrients set to "true" and aspectRatio set to "landscape", I also tried deleting aspectRatio as suggested in some stackoverflow answer, to no avail.
StageOrientationEvent.ORIENTATION_CHANGING is never dispatched in my application.
Another weird thing is happening, which might help you understand the situation better:
Even though aspectRatio is set to "landscape" in application.xml, the app opens in portrait mode, and stage.orientation returns "rotatedRight" (meaning landscape). I can only set to landscape properly by setting aspectRatio to "portrait" in application.xml, and then manually setting to "landscape" in runtime:
stage.setOrientation(StageOrientation.ROTATED_RIGHT);