Ashley_16 0 Newbie Poster

This is my code, which changes by frame, I need to do a scoring system, but when I used the following code to add a score it works fine for the first 2 frames then doubles and by the end it's like 229. Thank you for any help.

Score;

var score = 0;

function scoreIt(); {
    score += 1;
}

Frame by frame;

this.stop();

this.ans1.addEventListener("click", fl_MouseClickHandler.bind(this));

function fl_MouseClickHandler() {
    this.rocket2.play();
    this.rocket1.stop();
    this.rocket3.stop();
    this.next.mouseEnabled = true;
    this.ans2.mouseEnabled = false;
    this.ans3.mouseEnabled = false;

    this.ans2.answer2.color = ("#00ff00");
    this.ans1.answer1.color = ("#cd0000");
    this.ans3.answer3.color = ("#cd0000");
}

this.ans2.addEventListener("click", f2_MouseClickHandler.bind(this));

function f2_MouseClickHandler() {
    this.rocket1.play();
    this.rocket2.stop();
    this.rocket3.stop();
    this.next.mouseEnabled = true;
    this.ans1.mouseEnabled = false;
    this.ans3.mouseEnabled = false;

    this.ans2.answer2.color = ("#00ff00");
    this.ans1.answer1.color = ("#cd0000");
    this.ans3.answer3.color = ("#cd0000");

    scoreIt();
}

this.ans3.addEventListener("click", f3_MouseClickHandler.bind(this));

function f3_MouseClickHandler() {
    this.rocket3.play();
    this.rocket2.stop();
    this.rocket1.stop();
    this.next.mouseEnabled = true;
    this.ans2.mouseEnabled = false;
    this.ans1.mouseEnabled = false;

    this.ans2.answer2.color = ("#00ff00");
    this.ans1.answer1.color = ("#cd0000");
    this.ans3.answer3.color = ("#cd0000");
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.