On Nov 29, 11:26 pm, molistok <[email protected]> wrote: > > But I can see that when I call loadFromWaypoints into the loop then > don't go to the listener method. If I call loadFromWaypoints out of > the loop then works.
Yes: see the documentation: http://code.google.com/apis/maps/documentation/reference.html#GDirections.load "If a previous load() request has not completed when a new call to load () is invoked, the previous request is cancelled. Thus, you can use a single GDirections object to issue directions requests serially, but to generate multiple requests in parallel, you must use multiple GDirections objects." Every time round your loop you cancel the request you just issued. > How I can use listeners in a loop? You need to issue the next directions request from within the load listener function (that is, you don't do it in a "for" loop). However, I'm not sure what you are hoping to achieve with your existing code, even if you could do directions in parallel like that. What is your intended result? There may be a better way of getting there. Andrew -- 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.
