|
-
Timer reset in AS 2.0
Hi
Is it possible to reset a timer in AS 2.0? If, yes...how?
/S
-
FK'n_dog
a few more details would be good 
here is a simple example
the output window will update every second with the value of variable i
if i>10 the interval is cleared
Code:
var i:Number = 0;
traceInterval = setInterval(tracer,1000);
function tracer(){
i>10 ? clearInterval(traceInterval) : trace(i++);
};
hth ??
-
Thanks, but I was more after a reset function connected to the getTimer() function. Think the timer class is quite well developed in AS 3.0.
/S-fish
-
FK'n_dog
can you make use of this method using
2 buttons and a textfield, code on main timeline -
Code:
function pad(num){ return ("0"+String(num)).substr(-2, 2); }
function startT(){
d = new Date(); t0 = getTimer(); method = run;
};
function run(){
d.setTime(getTimer()-t0);
var h = pad(d.getUTCHours());
var m = pad(d.getUTCMinutes());
var s = pad(d.getUTCSeconds());
var ms = d.getUTCMilliseconds();
display = h+" : "+m+" : "+s+" : "+ms;
};
btnGo.onPress = function(){
method = startT;
};
btnReset.onPress = function(){
method = null; display = "00 : 00 : 00 : 000";
};
this.onEnterFrame = function(){
method();
};
startT();
hth
-
When in doubt ask
Hi! I've also got a timer thingy in my library, and Im attaching the same (F8).
I've tested it's working OK. Thanks if you can plz comment on this guys/gals.
Last edited by Eager Beaver; 08-19-2007 at 02:23 PM.
<signature removed by admin>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|