Time is never exact because frame rate is independent from time. Just check
if it's greater or equal to the time you desired.
var now = getTimer();
var waitSeconds = 3;
var later:Number = now + ( waitSeconds * 1000 );
this.onEnterFrame= function ()
{
var now = getTimer();
if( now >= later)
{
trace( "now" );
delete this.onEnterFrame;
}
else
{
var countdown = ( later - now );
trace( "wait for it : " + countdown );
}
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gustavo
Duenas
Sent: Friday, March 23, 2007 4:58 PM
To: [email protected]
Subject: [Flashcoders] setting a timer in flash 8
Hi, I'm trying to set a timer to trigger a event after 20 seconds or
less, but so far i have this code, but with no results
someone help me? .
I don't know how could I got into but some help might be needed
this is the code: is inside the first frame of a movie clip and the 4
frame has: gotoAndPlay(1);
var now = getTimer();
var seconds:Number = now/1000;
var later:Number = seconds+20;
this.onEnterFrame= function (){
if(seconds == later){
trace("llegamos");
}
}
trace(seconds);
Regards
Gustavo Duenas
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com