O'Reilly logo

Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications by Richard Wagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required