Chapter 7. Implementing Auto Orientation

WHAT'S IN THIS CHAPTER?

  • Rotating your app automatically

  • Working with StageOrientationEvent

  • Detecting an orientation change

If you are experienced in creating Flash or Flex applications for the Web or for Adobe Integrated Runtime (AIR) for Desktop, you are probably used to dealing with issues surrounding stretched versus fixed widths to account for different browser sizes or monitor resolutions. When you're developing for Android and iOS, it's a different world, because there is a new issue to contend with — screen orientation (or rotation).

Android and iOS users can change the orientation of their screens by physically turning the device with their hands. If an application changes its UI based on this change, it supports auto orientation. Therefore, application developers must face two key design questions:

  • Will my app support auto orientation? Or will it stay fixed at portrait or landscape?

  • If my app supports auto orientation, how should the UI change?

This chapter walks you through how to implement auto orientation into your Flash apps by focusing on how to respond to StageOrientationEvent events.

ENABLING YOUR APP TO ROTATE

Before you can implement auto orientation, you need to enable this feature in your Flash project. You can do this through the AIR Android Settings dialog box or by modifying the application descriptor XML file.

For Android apps, access the Android Settings dialog box (see Figure 7-1) by clicking the Android OS Settings Edit button ...

Get Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.