here is my code
_____________________
// stop the movie
stop();
//create the local Shared Object
// ### init main timeline variables
var displayTotal; // textfield for displaying user's final score
var totalCorrect = 0; // number of questions user answered correctly
var userAnswers = new Array(); // array containing the user's guesses
var currentQuestion = 0; // number of the question we're on
// ### the Question constructor
function Question (correctAnswer, questionText, answers) {
this.correctAnswer = correctAnswer;
this.questionText = questionText;
this.answers = answers;
}
// ### import the source file containing our array of question objects
#include "questionsArray.as"
// ### begin the quiz
makeQuestion(currentQuestion);
// ### function to render each question to the screen
function makeQuestion (currentQuestion) {
// clear the stage of the last question
questionClip.removeMovieClip();
// create and place the main question clip
attachMovie("questionTemplate", "questionClip", 0);
questionClip._x = 277;
questionClip._y = 205;
questionClip.qNum = currentQuestion + 1;
questionClip.qText = questionsArray[currentQuestion].questionText;
// create the individual answer clips in the question clip
for (var i = 0; i < questionsArray[currentQuestion].answers.length; i++) {
questionClip.attachMovie("answerTemplate","answer" + i, i);
questionClip["answer" + i]._y += 70 + (i * 15);
questionClip["answer" + i]._x -= 100;
questionClip["answer" + i].answerText = questionsArray[currentQuestion].answers;
}
}
// ### function to register the user's answers
function answer (choice) {
userAnswers.push(choice);
if (currentQuestion + 1 == questionsArray.length) {
questionClip.removeMovieClip();
gotoAndStop ("quizEnd"
;
} else {
currentQuestion++;
makeQuestion(currentQuestion);
}
}
// function to tally the user's score
function gradeUser() {
// count how many questions the user answered correctly
for (var i = 0; i < questionsArray.length; i++) {
if(userAnswers == questionsArray.correctAnswer) {
totalCorrect++;
}
}
// show the user's score in an onscreen text field
displayTotal = totalCorrect + "/" + questionsArray.length;
}
_____________________
// stop the movie
stop();
//create the local Shared Object
// ### init main timeline variables
var displayTotal; // textfield for displaying user's final score
var totalCorrect = 0; // number of questions user answered correctly
var userAnswers = new Array(); // array containing the user's guesses
var currentQuestion = 0; // number of the question we're on
// ### the Question constructor
function Question (correctAnswer, questionText, answers) {
this.correctAnswer = correctAnswer;
this.questionText = questionText;
this.answers = answers;
}
// ### import the source file containing our array of question objects
#include "questionsArray.as"
// ### begin the quiz
makeQuestion(currentQuestion);
// ### function to render each question to the screen
function makeQuestion (currentQuestion) {
// clear the stage of the last question
questionClip.removeMovieClip();
// create and place the main question clip
attachMovie("questionTemplate", "questionClip", 0);
questionClip._x = 277;
questionClip._y = 205;
questionClip.qNum = currentQuestion + 1;
questionClip.qText = questionsArray[currentQuestion].questionText;
// create the individual answer clips in the question clip
for (var i = 0; i < questionsArray[currentQuestion].answers.length; i++) {
questionClip.attachMovie("answerTemplate","answer" + i, i);
questionClip["answer" + i]._y += 70 + (i * 15);
questionClip["answer" + i]._x -= 100;
questionClip["answer" + i].answerText = questionsArray[currentQuestion].answers;
}
}
// ### function to register the user's answers
function answer (choice) {
userAnswers.push(choice);
if (currentQuestion + 1 == questionsArray.length) {
questionClip.removeMovieClip();
gotoAndStop ("quizEnd"
} else {
currentQuestion++;
makeQuestion(currentQuestion);
}
}
// function to tally the user's score
function gradeUser() {
// count how many questions the user answered correctly
for (var i = 0; i < questionsArray.length; i++) {
if(userAnswers == questionsArray.correctAnswer) {
totalCorrect++;
}
}
// show the user's score in an onscreen text field
displayTotal = totalCorrect + "/" + questionsArray.length;
}