> rides[r] is undefined
> var poly = rides[r].getPolyline();
>
> What does that error actually mean?

It means, when the javascript interpreter went to execute that line,
it couldn't come with anything sensible for rides[r].
That may be because rides[] isn't defined, or because r isn't defined,
or they are both defined but there has been no definition of rides
[whatever the value of r is] - at the time.

"at the time" is important.  You've put that line into an event
listener to be triggered later - in this case when the results (if
any) come back from the GDirections request.
Meanwhile, the rest of the code has bumbled on, setting up the next
GDirections request and its listener ... and the next.
All that is long over by the time the results come back and trigger
the first listener.
Sop, what's the value of r at that time?

Reference -
http://econym.org.uk/gmap/async.htm
http://econym.org.uk/gmap/closure.htm
See pitfall number three here -
http://econym.org.uk/gmap/basic1.htm
and when that's all working, you need to be aware of the issues raised
here -
http://econym.org.uk/gmap/geomulti.htm
because that applies to directions too.

cheers, Ross K



 And is the code even right to
> start with?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to