Being location aware, mapping is an integral part of iOS. The native Maps application lets you find where you currently are, search for nearby points of interest, and obtain turn-by-turn directions. Many developers take advantage of Maps by opening it directly from their own app, providing the user with a consistent experience.
Let us see how to do this.
From the book's accompanying code bundle, open chapter13\recipe8\recipe.fla
into Flash Professional.
Sitting on its stage is a button with an instance name of mapBtn
. We will add code to show the location of Adobe's headquarters when this button is pressed.
We will use Flash's
URLRequest
class and
navigateToURL()
function to open the Maps application.
Create a document class and name it
Main
.Import the classes required for this recipe and listen for the button being pressed:
package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.net.navigateToURL...