[Papervision3D] Simple Timer class for as3?

Roland Cozzolino rcozzolino at verizon.net
Wed Feb 21 15:23:24 EST 2007


Not sure if this is what you wanted . sort of a stop watch.  You can get
much more granular if you play with the uint returned from getTimer since
its in milliseconds and save everything as uint's objects instead of Date
objects

 

 

package

{

                import flash.utils.getTimer;

                

                public class StopWatch

                {

                                protected var prevTime:Date;

                                

                                public function StartTimer():void

                                {

                                                prevTime = new
Date(getTimer());

                                }

                                public function StopTimer():String

                                {

                                                var curTime:Date = new
Date(getTimer());

                                                var elapsedTime:Date = new
Date(0);

                                                elapsedTime.hours =
curTime.hours - prevTime.hours;

                                                elapsedTime.minutes =
curTime.minutes - prevTime.minutes;

                                                elapsedTime.seconds =
curTime.seconds - prevTime.seconds;

                                                return String(elapsedTime);

                                }

                }

}

 

From: Papervision3D-bounces at osflash.org
[mailto:Papervision3D-bounces at osflash.org] On Behalf Of John Grden
Sent: Wednesday, February 21, 2007 2:13 PM
To: Papervision3D at osflash.org
Subject: [Papervision3D] Simple Timer class for as3?

 

Just so i can save some time, does anyone have an as2/as3 (preferably 3)
timer class for displaying hh:mm:ss that has start / stop functionality
based on getTimer()?  I don't have anything handy

Thanks in advance ;) 

-- 
[  JPG  ] 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070221/a8dc576f/attachment.htm


More information about the Papervision3D mailing list