AS3 StageOrientationEvent.ORIENTATION_CHANGING无法在iPad3上工作iOS6
问题描述:
任何想法为什么我的代码不能在iPad3 iOS6上工作,还是Adobe空气的错误?AS3 StageOrientationEvent.ORIENTATION_CHANGING无法在iPad3上工作iOS6
的IPAD1和iPad2的下面的代码工作与iOS5的
if (startOrientation == StageOrientation.DEFAULT || startOrientation == StageOrientation.UPSIDE_DOWN){
stage.setOrientation(StageOrientation.ROTATED_RIGHT);}
else{
stage.setOrientation(startOrientation);
}
stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangeListener);
private function orientationChangeListener(e:StageOrientationEvent):void{
txt_rotate.text = 'Camed' + StageOrientation.ROTATED_LEFT;
if (e.afterOrientation == StageOrientation.DEFAULT || e.afterOrientation == StageOrientation.UPSIDE_DOWN){
e.preventDefault();
}else if(e.afterOrientation == StageOrientation.ROTATED_LEFT){
_stageOrientation = 'ROTATED_LEFT';
txt_rotate.text = _stageOrientation;
}else if(e.afterOrientation == StageOrientation.ROTATED_RIGHT){
_stageOrientation = 'ROTATED_RIGHT';
txt_rotate.text = _stageOrientation;
}
}
答
苹果在iOS6的SDK方向回调做了一些修改,从而使弃用某些功能。
preventDefault函数在StageOrientationEvent上不起作用。建议在需要时使用Stage.autoOrients为false。
http://blogs.adobe.com/airodynamics/2012/09/28/orientation-changes-in-air/
哇感谢ELIC – Bruce