Skip to main content
Known Participant
March 5, 2014
Question

Android app won't go upside-down unless aspectRatio is set to portrait

  • March 5, 2014
  • 1 reply
  • 459 views

My -app.xml file is a simple,

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<application xmlns="http://ns.adobe.com/air/application/4.0">

    <id>com.sixminute.plaintester</id>

    <filename>OtherTester</filename>

    <name>OtherTester</name>

    <versionNumber>0.0.0</versionNumber>

    <initialWindow>

        <content>[This value will be overwritten by Flash Builder in the output app.xml]</content>

        <!--

            <aspectRatio>portrait</aspectRatio>

         -->

        <renderMode>direct</renderMode>

        <autoOrients>true</autoOrients>

        <fullScreen>true</fullScreen>

        <visible>true</visible>

    </initialWindow>

    <android>

        <manifestAdditions><![CDATA[

            <manifest android:installLocation="auto">

                <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />

                <uses-permission android:name="android.permission.INTERNET"/>

            </manifest>

        ]]></manifestAdditions>

    </android>

    <iPhone>

        <InfoAdditions><![CDATA[

        ]]></InfoAdditions>

        <requestedDisplayResolution>high</requestedDisplayResolution>

    </iPhone>

</application>

And the entry point file, is just

package

{

    import flash.display.Sprite;

    import flash.display.StageAlign;

    import flash.display.StageScaleMode;

    import flash.text.TextField;

    public class OtherTester extends Sprite

    {

        public function OtherTester()

        {

            super();

            stage.align = StageAlign.TOP_LEFT;

            stage.scaleMode = StageScaleMode.NO_SCALE;

            var tx:TextField = new TextField();

            tx.text = 'hello world';

            tx.x = tx.y = 10;

            addChild(tx);

            trace(stage.supportedOrientations.join(', '));

        }

    }

}

the trace statement prints the full,

  default, rotatedLeft, rotatedRight, upsideDown

But no matter how I turn, I only get default (upright portrait), rotatedLeft and rotatedRight, never upsideDown.

I'm using AIR 4.0, and currently testing on a Nexus 5.

This topic has been closed for replies.

1 reply

seaders6mAuthor
Known Participant
March 5, 2014

If I manually handle it with,

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onReorientation);
...
protected function onReorientation(event:StageOrientationEvent):void
{
     if(event.afterOrientation != stage.orientation)

     {

           stage.setOrientation(event.afterOrientation);

     }

}

everything works as expected.  When you go upside down, event.afterOrientation is upside down, but stage.orientation is still whatever it was before.  Obviously this is a bug, no?