Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Time {
- import flash.utils.getQualifiedClassName;
- public static const TIME_IS_INTRINSIC:int = 0;
- public static const TIME_IS_EXTRINSIC:int = 1;
- private static const CLASSNAME:String = getQualifiedClassName(new Time());
- protected var paused:Boolean;
- protected var lastTime:uint;
- protected var accumulated:uint;
- public function Time():void {
- if (getQualifiedClassName(this) == CLASSNAME) throw new Error("Not allowed to instaniate abstract " + CLASSNAME + " object.");
- }
- public function get now():uint {
- if (!paused) lastTime = getTimer() - accumulated;
- else accumulated = getTimer() - lastTime;
- return lastTime;
- }
- public function pause():void { paused = true; }
- public function resume(timeMult:int):void {
- throw new Error("Method \"resume\" must be defined by child classes.");
- }
- public function get tick():ISignal;
- }
Add Comment
Please, Sign In to add comment