Skip to main content
Inspiring
October 17, 2012
Question

Stage orientation on a nook (android)

  • October 17, 2012
  • 5 replies
  • 888 views

I have had some of my apps fail approval for the new nook HD because I do not allow orientation changes in them. It didn't stop them beign approved for the normal nook, but there you go.

On iOS I use this code to only keep orientation to portrait. But this doesn't work on andorid, what other solution is there to fix it so you get no landscape orientation on an android device?

var startOrientation:String = stage.orientation;

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

{

 

}

else

{

stage.setOrientation(StageOrientation.DEFAULT);

}

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangeListener);

function orientationChangeListener(e:StageOrientationEvent)

{

if (e.afterOrientation == "rotatedLeft" || e.afterOrientation == "rotatedRight")

{

e.preventDefault();

}

}

This topic has been closed for replies.

5 replies

Colin Holgate
Inspiring
October 17, 2012

If you're using a recent version of AIR you can set the orientation to portrait, and remove your work around code.

joeboy_ukAuthor
Inspiring
October 17, 2012

And does that work on android?

How do I do it?

Colin Holgate
Inspiring
October 17, 2012

Yes, it works on Android, since AIR 3.3 I think. If you're using Flash Pro you choose it in the iOS settings, General tab. If you're using Flash Builder, set the app-descriptor values for autoOrients and aspectRatio, to true and portrait:

portrait</aspectRatio