On Jun 8, 6:16 pm, Anush <[email protected]> wrote: > ** > > I am trying to add external controls to play, pause and resume loading of > google markers. I used setTimeout to load markers with a delay. But can > somebody tell me where should I using clearTimeout to pause loading of > google markers? Using it in a separate function didn't work for me. > > for (var i = 0; i < all_markers.length; i++) { > t2 = setTimeout(function(){ > addMarker(); > },i * 300); > } > > function pauseAnimation(){ > clearTimeout(t2); > }
What do you think that loop is doing? To me it looks like it is creating all_markers.length timers, overwriting t2 with the latest one created, leaving it set to the last one. The pauseAnimation function will only cancel the last one. -- Larry > > Thanks -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
