我有一个Adobe AIR Actionscript for Mobile项目。我想发布它的行为如下:sensorLandscape“横向,但可以是基于设备传感器的正常或反向横向。” - 来自Android API documentation。
我已经设定:
<initialWindow>
<content>AppName.swf</content>
<aspectRatio>landscape</aspectRatio>
<autoOrients>true</autoOrients>
<initialWindow>
在App.xml中。
当从FlashBuilder 7发布调试文件时,结果出现在Nexus 7上 - 它始终是横向的 - 但它不会重新定位设备以显示反向横向。
答案 0 :(得分:0)
你没有提供任何代码所以我认为你不听:
stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChangeListener, false, 0, true);
//...
protected function orientationChangeListener(event:Event):void
{
/*
log("beforeOrientation:" + event["beforeOrientation"].toString()
+ "\nafterOrientation:" + event["afterOrientation"].toString());
*/
}
Android上的方向更改会创建视图的新实例,AIR不会这样,您必须通过聆听方向更改来编程,并相应地采取行动,例如通过旋转您的视图(和调整大小等)也检查舞台上的调整大小事件,因为它似乎更快地响应屏幕方向更改。
stage.addEventListener(Event.RESIZE, onStageResized, false, 0, true);
//...
protected function onStageResized(e:Event=null):void
{
trace("sr.Orientation: " + stage.deviceOrientation);
}
最好的问候