The Geolocation
class can be used to reveal a full set of properties for tracking device position on the globe. This is useful for mapping, weather, travel, and other location-aware applications. To measure this data and react to these measurements, we must perform certain actions.
We will need to employ certain ActionScript classes to allow monitoring of geolocation feedback:
1. First, import the following classes into your project:
import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.GeolocationEvent; import flash.sensors.Geolocation; import flash.text.TextField; import flash.text.TextFormat;
2. Declare a
TextField
andTextFormat
object pair to allow visible output upon the device along with aGeolocation
object:private var traceField:TextField; private var traceFormat:TextFormat; private var geolocation:Geolocation;
3. We will now set up...