Code:
stop();
var intID;
var endTime = getTimer() + (3 * 1000);
makeTime();
function updateTimer() {
var t = endTime - getTimer();
if (t > 0) {
makeTime();
showTime(t);
} else {
stopTimer();
showTime(0);
trace("lost");
//gotoAndStop("lost");
}
}
function makeTime() {
clearInterval(intID);
intID = setInterval(updateTimer, 100);
}
function stopTimer() {
clearInterval(intID);
}
function showTime(t) {
dispTime.text = (t / 1000) >> 0;
}
function gameWon() {
stopTimer();
trace("won");
//gotoAndStop("won")
}