iPhone Testing… Geolocation AS3 API

Well I hope your AS3 training is well underway by now..

I thought I’d share a spot of code with you, a new API in the flash.sensors package called Geolocation.  The package itself is enabled for iPhone applications (created with Flash Pro Cs5), FL4 and AIR in the future enabling you to create context-aware applications with ease.

The coolest thing is that you can test your applications that feature Geolocation in Device Central Cs5, very cool.

import flash.sensors.Geolocation;
import flash.events.GeolocationEvent;

var locale:Geolocation = new Geolocation();
locale.setRequestedUpdateInterval(5000);
locale.addEventListener(GeolocationEvent.UPDATE, onlocationHandler);

function onlocationHandler(e:GeolocationEvent):void{

lastLat = e.latitude;
lastLon = e.longitude;
gpsIcon_mc.visible = !gpsIcon_mc.visible;

}

Show Comments

Hide Comments

Comments are closed.