Are you new? Read the FAQ and catch up on!
4k views

Milliseconds timer using flash.utils.getTimer

This an easy and precise way to know how many milliseconds have passed since some point in your program.

First, you need to use the getTimer() function to save how many milliseconds have passed since the Flash Player started:

ActionScript 3
  1. startTime_ = flash.utils.getTimer(); // Milliseconds since flash player started
  2.  

­

Then, whenever you need to know how many milliseconds have passed, simply subtract getTimer() minus startTime_:

ActionScript 3
  1. millisecondsElapsed = flash.utils.getTimer() - startTime_;
  2.  

­

Tags: ActionScript 3.0 flex flash timer

Embed: