Thanks, I'll have to look into the callback routine. For now I also tried using a closure, which is working fine for my short example (like at http://code.google.com/apis/maps/documentation/events.html#Event_Closures).
-- Kay [email protected] wrote: > On Aug 3, 1:05 pm, Kay Wanous <[email protected]> wrote: >> I have maybe a silly question related to this now. If I find a value >> inside of my listener method, how can I use it outside of that method? >> Declaring a global variable outside of it and accessing it in my code >> after the directions call just results in it saying the variable is null. > > The GDirections call is asynchronous: > Javascript Concepts > Part 2 Asynchronous I/O > http://econym.org.uk/gmap/async.htm > > The best option is to put any code that uses that value inside the > callback routine. > > -- Larry > >> Thanks, >> Kay >> >> >> >> Mike Williams wrote: >>> This line doesn't create a copy of the directions polyline >>> poly = new GPolyline(directions.getPolyline()); >>> The first parameter of new GPolyline should be an array of GLatLng()s, >>> not a GPolyLine(). You end up with a polyline with no vertices, which >>> does have zero length. >>> Try using >>> poly = directions.getPolyline();- Hide quoted text - >> - Show quoted text - > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
