1 Reply Latest reply on Apr 12, 2017 10:47 PM by georgeh59

    Turning Visibility on and off

    georgeh59 Level 1

      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.