/ Published in: ActionScript 3
There are ways to calculate speed and altitude using the GeoLocation class. In the US, you can even calculate Miles Per Hour.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var geo:Geolocation = new Geolocation(); geo.addEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler); function geolocationUpdateHandler(e:GeolocationEvent):void { var altitude:Number = e.altitude; //Meters Per Second var mps:Number = e.speed; //Miles Per Hour var mph:Number = Math.round( (mps * 360000) / 160934.4 ) ); trace( "altitude:", altitude, "meters per second:", mps, "miles per hour:", mph ); }