UPDATE: I have released the extension including source on google code with some changes.
Euler Gyroscope ANE on Google Code
I baked my very first AIR iOS Native Extension. It’s just an adapted version of this version from Adobe. Because in my opinion the data of radians per second aren’t really good to handle. So I looked into Apples API documentation and found out that there are Euler Angles in the CMMotionManager CMDeviceMotion classes. So I just changed a few lines in the Objective-C Code. I learned much from this tutorial Native Extionsion for Adobe AIR and iOS 101 by Liquid Photo
NSString *myStr = [NSString stringWithFormat:@"%f&%f&%f&%f&%f&%f", rotate.x, rotate.y, rotate.z, motionManager.deviceMotion.attitude.roll, motionManager.deviceMotion.attitude.pitch, motionManager.deviceMotion.attitude.yaw]; [motionManager startDeviceMotionUpdates]; motionManager.deviceMotionUpdateInterval = 0;
And added these three parameters roll, pitch and yaw to the Actionscript Gyroscope Event.
new GyroscopeEvent(GyroscopeEvent.UPDATE, _x, _y, _z, _roll, _pitch, _yaw)
You can download source and final iOS .ane Native Extension file here:
iOS Air Native Extension Gyroscope – with Euler Angles