Available on all platforms
The Accelerometer class dispatches events based on activity detected by the device's motion sensor. This data represents the device's location or movement along a 3-dimensional axis. When the device moves, the sensor detects this movement and returns acceleration data. The Accelerometer class provides methods to query whether or not accelerometer is supported, and also to set the rate at which acceleration events are dispatched.
Note: Use the
Accelerometer.isSupported property to
test the runtime environment for the ability to use this feature. While the
Accelerometer class and its members are accessible to the Runtime Versions
listed for each API entry, the current environment for the runtime
determines the availability of this feature. For example, you can compile
code using the Accelerometer class properties for Flash Player 10.1, but
you need to use the
Accelerometer.isSupported property to test
for the availability of the Accelerometer feature in the current deployment
environment for the Flash Player runtime. If
true at runtime,
then Accelerometer support currently exists.
AIR profile support: This feature is supported only on mobile devices. It is not supported on desktop or AIR for TV devices. See AIR Profile Support for more information regarding API support across multiple profiles.
@event status Dispatched when an accelerometer changes its status.
**Note:** On some devices, the accelerometer is always available. On such devices, an Accelerometer object never dispatches a `status` event.
@event update The
update event is dispatched in response to
updates from the accelerometer sensor. The event is dispatched in the following circumstances:
* When a new listener function is attached through `addEventListener()`, this event is delivered once to all the registered listeners for providing the current value of the accelerometer. * Whenever accelerometer updates are obtained from the platform at device determined intervals. * Whenever the application misses a change in the accelerometer(for example, the runtime is resuming after being idle).
Creates a new Accelerometer instance.
Specifies whether the user has denied access to the accelerometer
true) or allowed access(
false). When this
value changes, a
status event is dispatched.
setRequestedUpdateInterval method is used to set the
desired time interval for updates. The time interval is measured in
milliseconds. The update interval is only used as a hint to conserve the
battery power. The actual time between acceleration updates may be greater
or lesser than this value. Any change in the update interval affects all
registered listeners. You can use the Accelerometer class without calling
setRequestedUpdateInterval() method. In this case, the
application receives updates based on the device's default interval.
The requested update interval. If
isSupported property is set to
true if the
accelerometer sensor is available on the device, otherwise it is set to