Monday, August 18, 2008

Flash Developers Need Some Direction in Life Too

Good arvo from Sydney, Australia, where it's beautiful even in the dead of winter and the people use contrived abbreviations for literally everything. I kid, I kid. Australia is great, and the vegemite is even greater. I've spent my winter internship (also called a "summer internship" for my compatriots above the Equator) working on the Google Maps API for Flash, which was released back in May. If you're like me, you might think that Flash is a tool for creating amateur cartoons of questionable legality after school. Friends, I assure you -- it's so much more.

JavaScript developers have reaped the benefits of driving directions in the Google Maps API for over a year now, but without them Flash developers have endured three long months of repeatedly getting lost. As someone who accidentally drove into Oklahoma for well over an hour before realizing that his roadtrip only involved Texas, I feel your pain, Flash folk. But worry no longer, for I bring good news. It has been my pleasure to rectify this disorientation dilemma and bring the enormous utility of driving directions to our Maps API for Flash, starting with version 1.6.

The interface for the Flash API's Directions class closely resembles that of the JS API's GDirections class. You still create a Directions object, optionally listen for load/fail events on it, and then call the load() method with a directions query. The Directions object contains all the response information as Route and Step objects, also like the JS API. The awesome thing about Flash is that you can then include all sorts of animations and movie clips to complement the directions in your application. Consider the following application which uses a penguin to show you how to get from the Alamo Drafthouse movie theater to Waterloo Records in Austin:




Sure you could probably whip that up in a JavaScript application, but envision this scenario: an animated car traverses the route of your roadtrip; your videos are overlaid onto the map at their original shooting locations; and your meticulously selected playlist of driving music plays chronologically in the background. And that, my friends, is the power of Flash.