Hi all! I found this quiz on a site and have been changing parts to help my project. The problem is if you look at the flash file (and code below within the file) you can see that you have to check in the right order for it give you the right answer! (the trace is present to give you an idea). Is there something I have to do for the “var correct answers” to make it work either way? Any ideas?
Also, instead of going to the next screen after clicking next i want the answer to display on the same page on the bottom!
I have a feeling there are more problems to this code but not sure! Thanks for all your help!!!
[LEFT]stop();
var userAnswer = new Array();
var correctAnswers = [3,1];
numQuestions = correctAnswers.length;
next.onRelease = function() {
gradeUser();
};
function gradeUser() {
var totalCorrect = 0;
for (i=0; i<numQuestions; i++) {
if (userAnswer* == correctAnswers*) {
gotoAndStop(3);
} else {
gotoAndStop(2);
}
}
}
function answer(choice) {
userAnswer.push(choice);
}
tick1.onRelease = function(choice) {
if (tick1.tickBox._currentFrame == 2) {
answer(1);
} else if (tick1.tickBox._currentFrame == 1) {
userAnswer.pop();
}
trace(userAnswer);
};
tick2.onRelease = function(choice) {
if (tick2.tickBox._currentFrame == 2) {
answer(2);
} else if (tick2.tickBox._currentFrame == 1) {
userAnswer.pop();
}
trace(userAnswer);
};
tick3.onRelease = function(choice) {
if (tick3.tickBox._currentFrame == 2) {
answer(3);
} else if (tick3.tickBox._currentFrame == 1) {
userAnswer.pop();
}
trace(userAnswer);
};
tick4.onRelease = function(choice) {
if (tick4.tickBox._currentFrame == 2) {
answer(4);
} else if (tick4.tickBox._currentFrame == 1) {
userAnswer.pop();
}
trace(userAnswer);
};
[/LEFT]
[LEFT]
[/LEFT]