GrandMark
08-07-2004, 03:34 AM
I'm making a game. The user has 2 minutes to answer all 5 questions correctly, each question being a different frame label. A user answers one question, it goes to the next label, all while still maintaining the counter.
After all 5 questions are answered, it takes you to another label stating something like "go back and try again". So this takes you back to question 1. The problem is, the timer now counts down twice as fast. Each time the user is sent to the main frame that the counter code is on, it speeds it up x2. Anyway of maintaining the counter speed consistent?
Here's the code on frame 1:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;
}else if (outputSec == 0) {
outputSec = "00";
}
if (outputSec == "00" && outputMin == "0"){
gotoAndStop("TimesUp);
}
}
}
chk=0;
stop();
timer = setInterval(countDown, 1000);
After all 5 questions are answered, it takes you to another label stating something like "go back and try again". So this takes you back to question 1. The problem is, the timer now counts down twice as fast. Each time the user is sent to the main frame that the counter code is on, it speeds it up x2. Anyway of maintaining the counter speed consistent?
Here's the code on frame 1:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;
}else if (outputSec == 0) {
outputSec = "00";
}
if (outputSec == "00" && outputMin == "0"){
gotoAndStop("TimesUp);
}
}
}
chk=0;
stop();
timer = setInterval(countDown, 1000);