Now: Tutorial for Web and Software Design > Flash > Flash Video > Flash Content
> Create a Timer with SetInterval and ClearInterval [Bookmark it]
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

[Bookmark][Print] [Close][To Top]
  • Prev Article-Flash:

  • Next Article-Flash:
  • Related Materias
    Introduction to ActionScri
    Examples of ActionScript 2
    Attaching Movie Clips usin
    Creating the Illusion of S
    Create Flying Hearts Effec
    Smooth Scrollbar
    Typewriter Effect
    Simple Authentication Syst
    Creating Sound Control
    Movie and Image Preloader 
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial