Copy link to clipboard
Copied
Hi all,
I am developing in AS3 AIR for Android in the flash cs5 IDE.
I want to develop an app that on click logs the users lat, lon, elevation, angle, and direction the phone's camera is pointing.
I know that the there are accelerometer and geolocation sensors in flash.sensors, but i am unclear as to if the accelerometer and geolocation can give me all the data i need. I know i can the lat and lon with geolocation.. i don't know how ever really how to interpret the data of the accelerometer, let alone how to determine the direction (n,e,w,s etc..) of the phone..
also, i am not sure i am running the most up to date AIR for Android extension but my extension manager doesn't seem to prompt me for an update..
Erik
Copy link to clipboard
Copied
The extension will not be updated. In fact, it is no longer available from adobe.com. To you the latest version of AIR for mobile, you are going to have to upgrade to CS5.5, or jump through some hoops to compile your apks.
As for the sensor data, the compass heading and elevation data points are currently not available.
Chris Griffith
Copy link to clipboard
Copied
You would not get the heading data, but altitude should return the correct value on Android.
Through Accelerometer, you would get the accelration in x, y and z direction. You cannot determine n,e,s,w through accelrometer. At the simplest you can make a maze ball, shake detector, and similar kind of applications.
Thanks,
Meet
Copy link to clipboard
Copied
Well i can get half of what i want done with lat, lon, and altitude form
geolocation and the x and y axis from the accelerometer.. But i desperately
need to know which way the phone is facing.. god how frustrating.. there
must be a way.. can someone explain to me the z axis? I am tracing it in a
text field and can make sense of the x and y but not sure what plain the z
axis is actually working on and why it appears to give off much different
number sizes than the x and y.. also if anyone can give me any idea how i
may cheat a little and fake the compass that would kick ass..
Erik
Copy link to clipboard
Copied
Well Accx,y and z all give accelration in x, y and z direction.
Imagine an AIR application opened with stage in portrait mode. Now imagine
X axis running from bottom left corner to bottom right corner,
Y axis running from bottom left corner to top left corner and
Z axis coming out from the face of the device.
When a device is lying flat on a table on its back z axis is pointing up and is under gravitational accelration of 1 g(9.8 m/s2) downwards. So you can imagine an acceration of 1 g upwards to make that device lie stable on the table.
When a device is under free fall, all three values will be 0.
When device is in upright position with its face poiting your front, accY would be 1 and accX, accZ would be 0.
I hope this helps in understanding the different values in other scenarios. Its just the aceeraltion in a specific direction. As a side note, accelrometer values would not give the direction the device's face is pointing to. For example in the last case above, if you rotate the device about its Y axis, all values would remain same, but the face is still pointing to different directions.
Thanks,
Meet
Copy link to clipboard
Copied
Meet,
I think what you said is a little confusing.. if i lay my phone on a table
at an agle on the Y axis that is NOT flat, but the phone is NOT moving..
it's perfectly still just slightly slanted, the accelerationX doesn't
reflect that the phone is not moving, it reflects the angle the phone is
sitting at.. In addition the Z seems to not reflect whether the phone is
falling or stationary, but instead whether it is laying face up or face
down..
I have a sprite on my stage that i am telling to change its distance from
the center of my stage based on the current accelerationX and Y in an
EnterFrame Event. Phone laying flat, it shows the circle center stage, and
as i angle my phone the placement of the sprite changes accordingly.. of
course, the sprite is center stage when the phone is laying flat regardless
of whether it is face up or face down.. ideally i want it to only be center
stage if face up.. as I essentially want the sprite to represent the center
ground.. I am assuming i want to use the z to do this but i am still trying
to understand exactly how the z works...
erik
Find more inspiration, events, and resources on the new Adobe Community
Explore Now