0

我有一个 Adob​​e AIR Actionscript for Mobile 项目。我想发布,使其行为类似于:sensorLandscape“横向,但可以是基于设备传感器的正常或反向横向。” - 来自Android API 文档

我已经设定:

<initialWindow>
    <content>AppName.swf</content>
    <aspectRatio>landscape</aspectRatio>
    <autoOrients>true</autoOrients>
<initialWindow>

在 App.xml 中。

结果是在从 FlashBuilder 7 发布调试文件时在 Nexus 7 上 - 它始终是横向的 - 但它不会随着设备重新定向以显示反向横向。

4

1 回答 1

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);
}

此致

于 2012-10-09T08:10:40.913 回答