Air for Android, a question of orientation.


So I’m working on AIR for Android lately with both my G2 and my Motorola Xoom, using Flex Builder 4.5. Some of you might know that I am getting them to talk together with RTMFP.

I have them talking, but the application that I am working on I need to start and stay in landscape format. So the obvious question is:

How do you do that?

Turns out the answer is easy, and I thought I would share.

In the applicationName-app.xml are settings for your AIR app. You need to change the autoOrients to “false” and the aspectRatio to “landscape” or “portrait”, depending on your needs.

If you haven’t ever taken a look at applicationName-app.xml then you really need to. It has lots of goodies there. This assumes that you are using Flex Builder, if you are coding with other editors or a text editor then you probably had to create it yourself.

That actually all you need to do!

As a side note, if your application tries to listen for the StageOrientationEvent.ORIENTATION_CHANGE event, and you have the autoOrients set to “false” then the event will never fire.

,

Leave a Reply