setInterval

Get all answers regarding ActionScript 2.0

setInterval

Postby amitsha86 on Fri Mar 20, 2009 9:41 am

Hi

How to use setInterval and When to use.

Thanks,

Amit :?

Bookmark and Share
amitsha86
 
Posts: 3
Joined: Fri Mar 20, 2009 9:33 am

Re: setInterval

Postby Ashish on Fri Mar 20, 2009 2:03 pm

/*
Hi Amit,
Mailny setInterval is used to Execute a partucular task after a given time duration, again and again. Chk the code bellow, Hope it will henp you
*/


Code: Select all

var InterValID1 = setInterval(IntID1_func, 1000);
function IntID1_func() {
   trace("Hi, I am being executed after every 1 second :)");
}
var InterValID2 = setInterval(IntID2_func, 3000);
function IntID2_func() {
   trace("Hi, I am being executed after every 3 second :)");
}
this.onMouseDown = function() {
   // Use This Two Line to Kill the Intervwl
   clearInterval(InterValID1);
   clearInterval(InterValID2);
   trace("Hi, YOU KILLED US :(");
};

Bookmark and Share
Ashish
 
Posts: 153
Joined: Tue Oct 14, 2008 1:49 pm

Re: setInterval

Postby flashankit on Thu Jan 12, 2012 11:08 am

set interval as2.0

Code: Select all
stop();
setInterval(function () {
play();
}, 5000);

---------------------------------------------------

stop()
var intervalId:Number;
var count:Number = 0;
var maxCount:Number = 2;
var duration:Number = 3000;
function executeCallback():Void {
trace("executeCallback intervalId: " + intervalId + " count: " + count);
gotoAndStop(2)
if(count >= maxCount) {
clearInterval(intervalId);
}
count++;
}
intervalId = setInterval(this, "executeCallback", duration);

Bookmark and Share
flashankit
 
Posts: 21
Joined: Fri Apr 23, 2010 12:39 pm
Location: Delhi


Return to ActionScript 2.0

Who is online

Users browsing this forum: No registered users and 1 guest