I created a button that looks up the coordinates of the device. There is no errors in the code but for some reason which is eluding me, the event is not being triggered.
Here is my code:
protected function lblCheckIn_clickHandler(event:MouseEvent):void
{
if (Geolocation.isSupported)
{
lblLat.text = "Finding Location...";
geo.addEventListener(GeolocationEvent.UPDATE, onUpdate);
}
else
{
lblLat.text = "Geolocation is not supported on this device.";
}
}
Later on I have the event code:
protected function onUpdate(event:GeolocationEvent):void
{
if (event.horizontalAccuracy <= 10)
{
Lat = event.latitude.toString();
Long = event.longitude.toString();
lblLat.text = Lat;
lblLong.text = Long;
geo.removeEventListener(GeolocationEvent.UPDATE, onUpdate);
navigator.pushView(PersonSelect);
}
else
{
lblLat.text = "Updating";
}
}
Oh, and I also did the usual imports
import flash.filesystem.File;
import flash.sensors.Geolocation;
import flash.events.GeolocationEvent
import spark.events.ViewNavigatorEvent
import flash.utils.ByteArray;
Any clues as to why my event isnt calling?