actionscript 3 - StageOrientationEvent is not dispatching on DEFAULT orientation (Portrait) -
intro: have air mobile as3 project, want receive orientation events onchange, never let device rotate screen (i necessary altering myself). set autoorients=true (needed orientation events) , try prevent device rotation e.preventdefault (now deprecated on ios).
you can download flashdeveloper project problem here. upload android device , let me know if stageorientationevents when rotating default (portrait).
the 3 other orientations fire fine , receive afterorientation:
- rotatedright
- rotatedleft
- upsidedown
but when rotating initial position (protrait) stageorientationevent not fire.
my application.xml ist this:
<visible>true</visible> <fullscreen>false</fullscreen> <autoorients>true</autoorients> <aspectratio>any</aspectratio> <resizable>true</resizable>
interesting tho is, when start app on mobile in landscape, receive:
- rotatedleft
- upsidedown
- default
so again, when rotating initial position (in case rotatedright) stageorientationevent ist not firing. initial position not give stageorientationevent.
this listener:
private function onorientationchanging(e:stageorientationevent):void { e.preventdefault(); ui.console.field.text += "\norientation_changing "+e.afterorientation; var rot:number = 0; switch (e.afterorientation){ case "rotatedright": rot = 90; break; case "rotatedleft": rot = -90;; break; case "upsidedown": rot = 180;; break; default: rot = 0; break; } tweenmax.to(ui.console.orient, 3, { shortrotation:{rotationz:rot}, ease:elastic.easeout } ); }
i tried removing e.preventdefault() in hope somehow not disabled auto-rotation of app somehow might prevent firing of default rotation. not case.
any ideas?
specs:
flashdevelop 5.0
sdk air17.0 + flex 4.6.0
android nexus 5 android 5.1.1
Comments
Post a Comment