Solved

AS3 step by step direction by google map

Posted on 2011-09-23
6
305 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't get text from a text entry 13 279
Flash movie or gif/animation? 3 890
Adobe Flash Free Transform Tool 2 136
PDF: Display my cards game? 8 109
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

813 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

10 Experts available now in Live!

Get 1:1 Help Now