setInterval() still exists; it's now a function in the flash.util package. But we do want folks to move to use Timer instead. Here's a Flex 2.0 example of using Timer:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"> <mx:Script> <![CDATA[ import flash.util.Timer; import flash.util.TimerEvent; import flash.util.TimerEventType; private var timer:Timer; private function startTimer():Void { timer = new Timer(1000); timer.addEventListener(TimerEventType.TIMER, timerHandler); timer.start(); } private function stopTimer():Void { timer.stop(); timer = null; } private function timerHandler(event:TimerEvent):Void { trace("timer"); } ]]> </mx:Script> <mx:Button label="Start Timer" click="startTimer();"/> <mx:Button label="Stop Timer" click="stopTimer();"/> </mx:Application> Here are a few things to note: 1. A Timer dispatches "timer" events which you handle like any other event. 2. When a Timer is first created with 'new', it is stopped; you have to use the start() method to start it. 3. This examples creates and destroys a Timer object each time you click the Start and Stop buttons. (Setting timer = null allows it to be garbage collected.) But you could also create a Timer object, say at app initialization, which you keep around, starting and stopping it multiple times. - Gordon -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Greg Johnson Sent: Thursday, October 20, 2005 10:25 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Flex 2: Where is the Timer Class This is a repost since we can't edit something we already did. I just wanted to clerify the subject line. Flex 2 docs say the old timer functions have been removed and there is a Timer Class. However in the docs for the Timer Class there is a blank page. Does anyone know where I can read about the methods etc of the new class? Or can tell me what they are? I am trying to write a new doubleClick checker and this need a timer. Thanks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/