hey dudes,
i just wanted to know if there is such
a thing as a "simple AS made timer"?
cause i would really like
to know how one is made
anyhoo, tnx a bunch!
Printable View
hey dudes,
i just wanted to know if there is such
a thing as a "simple AS made timer"?
cause i would really like
to know how one is made
anyhoo, tnx a bunch!
Yes... and No...
There is a simple function called setInterval(function, interval) which repeats a call to a function every... well, however often you want, down to once every millisecond.
If you wanted a timer you could just call a count function every 1000 milliseconds (1 second) and increment a variable. Then when you want to stop timing, just get the value of your counting variable and remove the counter with clearInterval().
Here is an example which will show you what I mean. Just paste this into a new flash document and test the movie:
var myCount:Number=0;
var myInterval:Number = setInterval(thisTimer,1000);
function thisTimer():Void {
trace(myCount);
myCount++;
}
Have fun,
And so much better than using onEnterFrame()
:)
lol, thnx dude!
oh i believe the script would be put
in a frame rather a movieclip right?
spot on... correct... well done.
7 cookies for you! mmm... cookies... sorry, I ate the other 3!
:)