The accelerometer sensor can be used when creating all sorts of games or applications for an Android device. One of the more frequent uses of this data is to update the position of a
DisplayObject on the
Stage in response to accelerometer update event data.
We will need to employ certain ActionScript classes to allow monitoring of accelerometer feedback through a
DisplayObject instance. In this example, we will employ a simple
Shape object and change its position based upon this data:
import flash.display.Shape; import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; ...