Basic Usage of setInterval


/ Published in: ActionScript
Save to your folder(s)

This will run the message function until countInterval equals 10, then it will stop. Could be used in various animations.


Copy this code and paste it in your HTML
  1. function displayMessage ():Void {
  2. trace("Display this message");
  3. countInterval++;
  4. if(countInterval >= 10){
  5. clearInterval(nInterval);
  6. trace("interval cleared");
  7. }
  8. }
  9.  
  10. var countInterval:Number = 0;
  11. var nInterval:Number = setInterval(displayMessage, 1000);

Report this snippet


Comments


You need to login to view comments.