Wasn't it Roland who wrote:
>For the purposes of asking this question, I have commented out the
>"load(i)" function call, which works, and uncommented the setTimeout
>(function(){load(i);},i*1000);, which does not work.
You're not obtaining Function Closure on your "i" variable.
When you write load(i), it uses the value that's in your "i" variable
now.
When you write setTimeout(function(){load(i);},i*1000); it uses the
value that's in your "i" variable at some time in the future, after the
for loop has completed.
Try
setTimeout( "load("+i+")" , i*1000);
which should evaluate "i" during the loop.
--
Mike Williams
http://econym.org.uk/gmap
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---