3 Replies Latest reply on Dec 12, 2008 5:40 AM by andyulrika_is_back

    Multiple Choice Quiz

    andyulrika_is_back Level 1
      I have a multiple choice quiz with a final score after the last question. As a selection is made from 4 questions with buttons - instant feedback of a tick or cross graphics replace the 4 buttons (1 tick and 3 crosses).

      The only problem being that if I select a different answer after receiving the result, the final score is affected. So, I need to somehow disable the buttons from receiving any more interacation from a mouseup after I have made a selection.

      If you have any clue what I'm talking about - do you have a smart piece of code which disables any more interaction for each question after it has been answered.

      Thanks in advance.

      Andy
        • 1. Re: Multiple Choice Quiz
          Level 7
          This is a perfect example of where you would use a flag. When started
          the flag (property) would indicate to code in the same script object
          that it was "active". When your questions are all marked, or you
          otherwise want to disable your code from responding to user interaction,
          you alter the flag. Then in all the code dealing with mouse interaction
          you check the flag first in order to determine whether it should even run.

          Something like:
          --
          property myActive

          on beginSprite me
          -- ...
          myActive = 1
          end

          on mouseUp me
          if myActive <> 1 then exit
          -- ...
          end

          on mSetActive me, bActive
          myActive = bActive
          end


          When you mark all your questions you can disable any sprites that have
          this code attached to them with:
          _movie.sendAllSprites(#mSetActive, FALSE)
          • 2. Re: Multiple Choice Quiz
            andyulrika_is_back Level 1
            Hi Sean

            Thanks very much for the code.

            Although, I'm still a bit lost as how to integrate it with my existing code...

            I've attached the code, you'll probably notice some amateurish coding - still learning.

            Anyway, here it is, if you could give me some indication where I should put it, much appreciated.
            • 3. Re: Multiple Choice Quiz
              andyulrika_is_back Level 1
              Hi Sean

              Thanks very much for the code.

              Although, I'm still a bit lost as how to integrate it with my existing code...

              I've attached the code, you'll probably notice some amateurish coding - still learning.

              Anyway, here it is, if you could give me some indication where I should put it, much appreciated.