> > Tutorials > T1051

Create a timer with setInterval and clearInterval.


Calls function every timeout (in miliseconds). Returns intervalId.


Cancels an interval created by a call to setInterval().


function outoftime(){	Edit1 = "Out of time";	clearInterval(interval1); // stop repeating this function}// set 2000 miliseconds timer (2000 ms = 2 seconds)interval1 = setInterval(outoftime,2000);

Download source project (1 kb)

  1. Launch Flash Designer and set movie dimensions 300 x 300.
  2. Create edit filed that will appear as Edit1
  3. Choose “Frame” > “ActionScript” and paste the example code.
  4. Set frame delay to stop (“Frame” > “Frame Delay”).
  5. Hit F9 to play the file

get flash