Function getTimer()

Hey GUys,

I dnt know how to do the actionscript tags so im gonna use the PHP ones!


function startTimer() {
initial = getTimer()/1000;
}

If this function gets called, what exactly happens here? Does it reset the timer? Or just gets the time the swf has been playing?

Because when you use this mouse listener


mouseListener = new Object();
mouseListener.onMouseDown = startTimer;

It actually resets the time everytime you mouseDown.

Does this make sense? Or do i need to write more?

This is the code all together. Thanks in advance :slight_smile:

 
mySeconds = 3;
mouseListener = new Object();
function startTimer() {
initial = getTimer()/1000;
}
function doyourstuff() {
_root.onEnterFrame = null;
_root.gotoAndStop(10);
}
_root.onEnterFrame = function() {
elapsedTime = Math.floor(getTimer()/1000-initial);
if (elapsedTime == mySeconds) {
doyourstuff();
}
trace(elapsedTime);
};
mouseListener.onMouseDown = startTimer;
Mouse.addListener(mouseListener);
startTimer();