Don't forget to clear the interval inside the function you call - otherwise it will repeat on and on. It's also best practice to clear an interval before you set it (in case it gets set twice).
If you only want the function called once you can also use _global.setTimeout( func, time ). J -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Parvaiz Patel Sent: 26 March 2007 13:51 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] setting a timer in flash 8 Hi Gustave, Here is the answer to your query. The best way for any timing related task is to use Interval. Here is the syntax: var <variable name>:Number = setInterval(<function name to call>, <time interval in millisecond>); function <function name to call>(){ //do your task here.. } //////////////////////////////////////////// The following is the example for your inderstanding & testing. this.createTextField("date_txt", this.getNextHighestDepth(), 10, 10, 100, 22); date_txt.autoSize = true; date_txt.selectable = true; var date_interval:Number = setInterval(updateTime, 500, date_txt); function updateTime(my_txt:TextField) { my_txt.text = new Date().toString(); trace(my_txt.text); } I hope, this is well enough to solve your problem. Thanks & regards, Parvaiz Patel. > Gustavo Duenas wrote: >> 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 >> >> >> >> _______________________________________________ >> Flashcoders@chattyfig.figleaf.com >> 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 >> >> >> > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > 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 > > > _______________________________________________ Flashcoders@chattyfig.figleaf.com 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 _______________________________________________ Flashcoders@chattyfig.figleaf.com 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 _______________________________________________ Flashcoders@chattyfig.figleaf.com 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