5 Replies Latest reply: Apr 12, 2012 7:21 AM by spinlight RSS

    Can't seem to control screen orientation on Android

    spinlight Community Member

      I'm trying to use Flash Pro with Air 3.2. I'm used to making apps for iOS and the orientation handling seem much more elegant.

      Can someone point me in the right direction for Android. There must be a magic combination of setttings to get this to work?

       

      Trying to use this with Aspect set to Landscape and Orientation set to Auto, but it really freaks out on my Galaxy tab. Keeps switching all the time and rarely matches the orientation I am holind the tablet in.

       

      stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangeListener);

      var startOrientation:String = stage.orientation;

       

      if (startOrientation == "default" || startOrientation == "upsideDown") {

                stage.setOrientation(StageOrientation.ROTATED_RIGHT);

      } else {

                stage.setOrientation(startOrientation);

      }

       

      function orientationChangeListener(e:StageOrientationEvent) {

                if (e.afterOrientation == "default" || e.afterOrientation == "upsideDown") {

                          e.preventDefault();

                }

      }

       

      EDIT: I'm using a Galaxy Tab to test if that matters. It seems like my device is pretty slow to react to orientation on the desktop, but it goes haywire in my app.

       

       

      Thanks for any help you can provide.