all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

setInterval inside for loop doesn't work


Re: setInterval inside for loop doesn't work tralfaz
11/26/2004 5:33:20 PM
flash actionscript:
// Here is a different way that you could try..
// tralfaz

// main timeline code frame 1
onLoad = function()
{
function someFunction()
{
i++;
if(i > 10)
i = 0;
trace("i = " + i);
// do something else every 3 seconds here
}
idInt = setInterval(someFunction, 3000);
}


[quoted text, click to view]

setInterval inside for loop doesn't work zzdobrusky
11/26/2004 8:50:44 PM
Hi, can anybody help? Trying to do a simple wait function inside loop so i can
control how fast the loop runs, I figured out this code but it doesn't work,
any ideas anybody? for(var i=0; i<=10; i++) { trace(i); waitF(3000); }
function waitF(hitTime) { trace('inside waitF'); idInt =
setInterval(clearInt, hitTime); } function clearInt() { trace('inside
clearInt'); clearInterval(idInt); }
Re: setInterval inside for loop doesn't work zzdobrusky
11/27/2004 3:36:40 AM
Thanks, that worked great!
AddThis Social Bookmark Button