Solved

AS3 step by step direction by google map

Posted on 2011-09-23
6
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

739 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