?
Solved

AS3 step by step direction by google map

Posted on 2011-09-23
6
Medium Priority
?
332 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 2000 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
Technology Partners: 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

762 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