Measuring the Angle of your Phone in AIR for Android and ActionScript 3 | Everything about Flash |
The Accelerometer is one of the exciting new user interfaces offered by mobile devices. There are many tutorials that explain how to read basic data about the orientation of the mobile device, but for some applications you will want to convert this data into more conventional information such as, "What is the angle my phone makes with the horizontal?" Instructors of trigonometry and calculus will know this as the angle of elevation, which is commonly used to answer questions like , "How tall is that big tree that is 20 feet in front of me?" (Answer: The tree is 20 times the tangent of the angle of elevation higher than where you are holding the phone.) Don't worry. This tutorial does not intend to become a trigonometry lesson! Note that there is no "web-based version" for this app since your average computer browser does not support the accelerometer event.