我有一个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发布调试文件时,在Nexus7上的结果是它始终是横向的-但它不会随设备重新定向以显示相反的横向。
发布于 2012-10-09 16:10:41
你没有给出任何代码,所以我建议你不要听:
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 on orientation change会创建新的视图实例,而AIR并非如此,所以你必须通过监听方向变化来对其进行编程,并采取相应的行动,例如旋转视图(和调整大小等)。还要检查舞台上的调整大小事件,因为它似乎更快地响应屏幕方向的变化。
stage.addEventListener(Event.RESIZE, onStageResized, false, 0, true);
//...
protected function onStageResized(e:Event=null):void
{
trace("sr.Orientation: " + stage.deviceOrientation);
}诚挚的问候
https://stackoverflow.com/questions/12793228
复制相似问题