On Sep 26, 1:17 pm, jameslove <[EMAIL PROTECTED]> wrote: > Hi All, > I was mucking about with the new walking route stuff and ran into > something I don't understand. Here's the > codehttp://www.wheresthebeachdude.com/walk2.html > > gdir = new GDirections(map, document.getElementById("route")); > setDirections("1010 39th Ave NW, Calgary, Canada", "800 Macleod Trail > SE ,Calgary, Canada", "en_US"); > document.getElementById('distanceWalked').innerHTML=gdir.GDirections.getDis > tance().html; > > My question has to do with getting the distance. I tried a number of > variants on the third line in order to grab the distance. I realized I > was just guessing at how the various methods relate to the defined > objects. I am an old structured programmer so sometimes the Object > Oriented stuff is a challenge. It is the my OOP limitations or am I > missing a key concept in how the API fits together with the > Javascript? > > gdir.GDirections.getDistance().html; > gdir.getDistance().html; > GDirections.getDistance().html; > GDirections.getDistance();
(a key concept in how the API fits together with the javascript) GDirections is asynchronous, Mike Williams' explanation: Part 2 Asynchronous I/O http://econym.org.uk/gmap/async.htm You would get it something like this: GEvent.addListener(gdir, "load", function() { document.getElementById('distanceWalked').innerHTML=gdir.GDirections.getDistance().html; } -- Larry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
