• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Turning Visibility on and off

Explorer ,
Apr 12, 2017 Apr 12, 2017

Copy link to clipboard

Copied

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.

Views

191

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Apr 12, 2017 Apr 12, 2017

Never mind I worked it out.

Same function name on both buttons.

Votes

Translate

Translate
Explorer ,
Apr 12, 2017 Apr 12, 2017

Copy link to clipboard

Copied

LATEST

Never mind I worked it out.

Same function name on both buttons.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines