Responding to accelerometer changes

The accelerometer provides access to data that represents the device's location or movement along a three-dimensional axis. When motion is detected, it is returned as data, which can be accessed by ActionScript.

This recipe will show you how to take advantage of the accelerometer found in iOS devices.

Getting ready

An FLA has been provided as a starting point.

Open chapter9\recipe4\recipe.fla from the book's accompanying code bundle into Flash Professional.

You will find five dynamic text fields positioned on the stage. Below them is a movie clip with an instance name of arrow. We will populate each text field with data retrieved from the device's accelerometer and rotate the movie clip to reflect physical changes ...

Get Flash iOS Apps Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.