Skip to main content
georgeh14253769
Inspiring
April 13, 2017
Answered

Turning Visibility on and off

Hi,

I am one of those eternal newbies when it comes to javascript code.

I have a true/false quiz I am putting together and whether the students press true or false it goes to the next frame which tells them what the right answer is.

The only difference is that if you pressed the wrong button then it will say incorrect (or correct if you chose the right T/F button) prior to displaying the full answer.

I thought I could do this by having two movie clips with no more than a word of text i.e. "correct" and "incorrect". The two words are superimposed on one another and the True/False buttons turn off the visibility of one of the two words according to whether the right answer was pressed or not. Here's the code.

this.q1correct_btn.addEventListener("click", fl_ClickToGoToAndStopAtFrame_2.bind(this));

function fl_ClickToGoToAndStopAtFrame_2()

{

    this.gotoAndStop(3);

    this.correct.visible = false;

}

this.falseq1_btn.addEventListener("click", fl_ClickToGoToAndStopAtFrame_2.bind(this));

function fl_ClickToGoToAndStopAtFrame_2()

{

    this.gotoAndStop(3);

    this.incorrect.visible = false;

}

Just doesn't work. Either answer is pressed only the "correct" txt shows up. Anyone can help?

thanks,

George.

    This topic is closed to new replies. Start a new post to keep the conversation going.
    georgeh14253769
    georgeh14253769Correct answer
    Inspiring
    April 13, 2017

    Never mind I worked it out.

    Same function name on both buttons.

    1 reply

    georgeh14253769
    georgeh14253769AuthorCorrect answer
    Inspiring
    April 13, 2017

    Never mind I worked it out.

    Same function name on both buttons.

    Translate