Help on reset button

Hello everyone.

I need some help to add a Function to reset the scores. This is my action script. I found this quiz and this is the action script. Now, I want to create a reset button because when I repeat the game, the score is visible and I don’t want that. So, I’m thinking of creating a reset button to clear the scores. Or if you can add a Function to clear it.

Please I need help.

Regards,

jazgirl

//--------------------------------------------------------
// Multiple Choice Quiz, By Colin Moock
// Functions and Arrays Version, for Flash MX
// For the accompanying tutorial, see Chapters 9 and 11 of
// ‘ActionScript for Flash MX: The Definitive Guide’
//--------------------------------------------------------
// Stop the movie at the first question.
stop();
// ===================
// INIT QUIZ VARIABLES
// ===================
// Store a reference to the timeline that contains the quiz user interface.
var quizTimeline = this;
// Create an array to contain user’s answers.
var userAnswers = new Array();
// Create an array to contain each question’s correct answer.
var correctAnswers = [3, 1, 3, 1, 1, 4, 1, 4, 2, 2];
// Create a convenience variable to store the number of
// questions in the quiz.
var numQuestions = correctAnswers.length;
// =====================
// CREATE QUIZ FUNCTIONS
// =====================
// Function: answer()
// Desc: Registers the user’s answers to quiz questions and
// advances the quiz through its questions.
// Params: choice The user’s answer for the current question.
function answer (choice) {
// Add the current answer to the list of user answers.
userAnswers.push(choice);
// Create a convenient variable to store the number
// of the current question.
var currentQuestion = userAnswers.length;
// Display the question and answer in the Output window for debugging.
trace("Question " + currentQuestion

  • ". The user answered: " + userAnswers[currentQuestion-1] + “.”);
    // If we’re on the last question…
    if (currentQuestion == numQuestions) {
    // …go to the quiz end frame.
    quizTimeline.gotoAndStop(“quizEnd”);
    // And grade the user.
    gradeUser();
    } else {
    // …otherwise, go to the next question frame.
    quizTimeline.gotoAndStop(“q”+ (currentQuestion + 1));
    }
    }

// Function: gradeUser()
// Desc: Tallys the user’s score at the end of the quiz.
function gradeUser() {
// Report that we’re about to grade the quiz in the Output window.
trace(“Quiz complete. Now grading…”);
// Create a local variable to track the
// number of questions user answered correctly.
var totalCorrect = 0;
// Count how many questions the user answered correctly.
// For each question…
for (var i=0; i < numQuestions; i++) {
// If the user’s answer matches the correct answer.
if(userAnswers* == correctAnswers*) {
// Give the user a point.
totalCorrect++;
}
// Display the correct answer and the user’s answer
// in the Output window for debugging.
trace("Question " + (i + 1)

  • ". Correct answer: " + correctAnswers*
  • ". User’s answer: " + userAnswers*);
    }
    // Display the final score in the Output window for debugging.
    trace("User’s score: " + totalCorrect + “/” + numQuestions);
    // Create an onscreen text field do display the user’s score.
    quizTimeline.createTextField(“totalOutput_txt”, 1, 150, 200, 200, 20);
    // Show the user’s score in an onscreen text field.
    quizTimeline.totalOutput_txt.text = "Your final score is: "
  • totalCorrect + “/” + numQuestions;
    // Customize the font face, size, and color of the text field.
    var formatObj = new TextFormat();
    formatObj.size = 16;
    formatObj.color = 0xF65095;
    formatObj.font = “_sans”;
    formatObj.bold = true;
    quizTimeline.totalOutput_txt.setTextFormat(formatObj);
    }

// =================================
// DEFINE QUIZ BUTTON EVENT HANDLERS
// =================================
// Code executed when button 1 is pressed.
choice1_btn.onRelease = function () {
// Call answer(), which records the user’s choice
// and advances the quiz to the next question.
this._parent.answer(1);
};
// Code executed when button 2 is pressed.
choice2_btn.onRelease = function () {
this._parent.answer(2);
};
// Code executed when button 3 is pressed.
choice3_btn.onRelease = function () {
this._parent.answer(3);
};
// Code executed when button 4 is pressed.
choice4_btn.onRelease = function () {
this._parent.answer(4);
};