Jump to content


every 10 secs


  • You cannot reply to this topic
1 reply to this topic

#1 Ahmult

    Young Padawan

  • Members
  • Pip
  • 47 posts

Posted 13 October 2006 - 07:18 PM

How can I set to load the function every 10 sec. e.g like
Firstly, load function a
after 10 sec, load function b
after 10 sec load function c

Do anyone know how to do that?

#2 PixelHiveDesign

    Young Padawan

  • Members
  • Pip
  • 83 posts
  • Gender:Male

Posted 13 October 2006 - 09:26 PM

Use the built in function setInterval.

setInterval(functionName, interval, params );

interval is in milliseconds.
so 10 sec would be 10000.
example:

function spitFire(timeIs){
	 trace("FFOOOOOOOSSSSSSH!!!  Crackel CRaCKel! at: "+ timeIs);
}


myInterval = setInterval(spitFire, 10000, getTimer());

If you ever want to stop the function calls you must clear the interval:

clearInterval(myInterval);

Good luck,

Max (PHD)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users