Solved

AS3 step by step direction by google map

Posted on 2011-09-23
6
294 Views
Last Modified: 2012-05-12
Hi,

I was wondering if I can get a tip of how to have a step by step direction from google map. In my app, I can display the direction on the map but I also want to have the written step by step direction on the side.
0
Comment
Question by:Angha110
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 36713606
When you will get responce from Google API you can get Route object
Here is an example:

function onDirectionsLoaded(event:DirectionsEvent):void
{
      var returnedDirection:Directions = event.directions as Directions;
      
      var route:Route = dir.getRoute(0);
      for(var i:uint = 0; i < route.numSteps; i++){
            var step:Step = route.getStep(i);
            trace(step.descriptionHtml + " - " + step.distanceHtml + ", " + step.durationHtml);
      }
}
0
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36713608
function onDirectionsLoaded(event:DirectionsEvent):void
{
      var dir:Directions = event.directions as Directions;
      
      var route:Route = dir.getRoute(0);
      for(var i:uint = 0; i < route.numSteps; i++){
            var step:Step = route.getStep(i);
            trace(step.descriptionHtml + " - " + step.distanceHtml + ", " + step.durationHtml);
      }
}
0
 

Author Closing Comment

by:Angha110
ID: 36717795
Thank you
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Angha110
ID: 36718143
One more question,
How do I set the dynamic text to properly display the step by step.

Here is what I get from a imaginary address:

Head <b>northeast</b> on <b>Flying Cloud Dr</b> toward <b>Singletree Ln</b> - 0.2&nbsp;mi, 20 secs
Turn right onto <b>W 78th St</b> - 1.4&nbsp;mi, 3 mins
<b>W 78th St</b> turns right and becomes <b>Town Line Ave</b><div class="google_impnote">This road is closed until Oct 31</div> - 0.3&nbsp;mi, 43 secs
Turn left onto <b>US-169 N</b> - 8.3&nbsp;mi, 8 mins
Take the exit onto <b>I-394 W</b> - 1.6&nbsp;mi, 3 mins
Take exit <b>1C</b> for <b>Ridgedale Dr</b> - 0.2&nbsp;mi, 27 secs
Turn right onto <b>Ridgedale Dr</b> - 259&nbsp;ft, 5 secs
Turn left onto <b>N Frontage Rd/<wbr/>Wayzata Blvd</b><div class="google_note">Destination will be on the right</div> - 0.4&nbsp;mi, 1 min
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36718243
0
 

Author Comment

by:Angha110
ID: 36718433
This is great, thank you again for the great help.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to record live broadcast.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now