Okay, so I am working on a mobile app in OpenFL and Haxe. I would like to gather input from the gyroscope, or more specifically about the orientation of the phone. I have searched the openfl docs, and google for some kind of documentation or examples on this sort of thing. I had no luck there and would like to know if anyone could point me toward some.
Asked
Active
Viewed 472 times
1 Answers
6
Make a new Accelerometer:
private var _acc:Accelerometer = new Accelerometer();
Add an event listener to it:
_acc.addEventListener(AccelerometerEvent.UPDATE, updateAcc);
Listen to results:
private function updateAcc(Event:AccelerometerEvent):Void { trace("x:" + Event.accelerationX); trace("y:" + Event.accelerationY); trace("z:" + Event.accelerationZ); }
Note than iOS accelerometer values are inverted.

Michael Yaworski
- 13,410
- 19
- 69
- 97

Jeru Sanders
- 76
- 3