Minimum time resolution
♥0 |
Line 26 |
Modified 2011-02-26 22:50:57 |
MIT License
archived:2017-03-20 13:36:07
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pXhA
*/
package {
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.utils.getTimer;
import flash.utils.setTimeout;
import flash.text.TextField;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
var tf:TextField = new TextField;
var t:int;
addChild(tf);
var timer:Timer = new Timer(0);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
var lastTimeSampled:int = 0;
function onTimer(event:TimerEvent):void {
if ((t - lastTimeSampled) > 1000) {
lastTimeSampled = getTimer();
tf.text = (lastTimeSampled - t) + ' ms';
}
t = getTimer();
}
}
}
}