Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Create a Timer with SetInterval and ClearInterval
Your Ad Here

Create a Timer with SetInterval and ClearInterval


Create a Timer with SetInterval and ClearIntervalThis tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.

setInterval(function,timeout);

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

clearInterval(intervalID);

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

Example:

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 t1051.zip (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


Author's URL: Selteco.com
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Internet & computing Flash is a vector-based moving graphics format created by Macromedia for the publication of animations on the World Wide Web. More Flash & Swish: Most Popular Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

Add comments to "Create a Timer with SetInterval and ClearInterval"

Only registered users can write comment

Reader's comments