0 Replies - 998 Views - Last Post: 30 October 2009 - 09:42 AM

#1 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Execution Timer Class

Posted 30 October 2009 - 09:42 AM

Description: Save class as ProcessTimer.as in the same folder as your fla, or modify the package accordingly. Import and instantiate as normal, use startTimer() to start the Timer, and stopTimer() to stop. stopTimer() returns the milliseconds since startTimer() was called.Lets you time how many milliseconds have passed between two points in your code. Is unaffected by slow-down.
package {

	public class ProcessTimer {

		
		private var time		:int;
		

	
		public function ProcessTimer():void {
			//empty	
		}

	
		public function startTimer():void {
			var date:Date = new Date();
			time = date.getTime();
		}
		
		public function stopTimer():int {
			var date:Date = new Date();
			return date.getTime() - time;
		}


	
		public function toString():String {
			return "ProcessTimer";
		}
	
	}
}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1