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;

}

  • http://natejc.com/blog/2010/02/iphone-development-in-flash-cs5-beta-link-dump/ NateJC.com – Flash & ActionScript 3 info, source, & experiments » Blog Archive » iPhone development in Flash CS5 Beta (link dump)

    [...] iPhone apps built with Flash CS5, Adobe TV Example iPhone apps built with Flash CS5, Adobe Labs iPhone Geolocation AS3 API, Mark Doherty Applications for iPhone:Developer FAQ, Adobe Labs Developing for the Apple iPhone [...]

  • http://www.theparodynetwork.com Sexy Games

    Nice feature. This API is amazing, so is AS3. I am currently migration from AS2 to AS3.

  • http://twitter.com/jodieorourke Jodie O’Rourke

    Hey Mark. I know this is an old post, but how do you test the Geolocation API with the new AIR 2.5 support in Device Central CS5.5? There doesn’t appear to be any documentation on how to get up and running with this new feature.

    As an aside, someone seems to like your blog so much that they’re copying and pasting it into their own: http://priyeshsheth.wordpress.com/2011/08/10/geolocation-as3-api-for-iphone

  • http://www.facebook.com/rachalmers Robert Chalmers

    Do you have a full working example/tutorial for the iPhone please?