1 Reply Latest reply on May 10, 2006 12:39 PM by TimSymons

    matching quiz

    michaelcummings


      Ok, this may not be that big of a problem, but i've wasted away several hours trying to fix my problem here....
      Im trying to make a sort of matching game, with questions and a wordbank. A user should be able to drag the words from the word bank into the boxes and then a check will be done on the drop on wether or not it is in the correct box.
      The catch here is that it is all dynamic movie clips. I dont know how many questions and answers they are because they are changed and loaded from an XML file.

      I dont know if it is going to work but I was hoping to just declare an id for each one of the clips as i created them, but i still dont know how to match them up...

      I desperatly need help getting the checking part of this working, as right now I cannot even figure out the logic behind it. I cant hard code in any drop zone boundaries, because I dont know how many questions and answers, or what box, and after I get this working I have to be able to randomize the wordbank.

      Any help is going to be greatly appreciated.

      //---------CODE------------------------------------------------------------------
        • 1. Re: matching quiz
          TimSymons Level 1
          I wrote a simliar engine for a dynamic quiz generator. This is really close. You should add code to your clip.onRelease event to call a function that will check to see if 2 movieclips "id" properties are the same.

          clip.onRelease = functio() {
          stopDrag();
          compareID(this, eval(this._droptarget));
          };

          Then somewhere outside your buildAnswerList function define your compareID function (or whatever you would like to name it).

          function compareID(m1:MovieClip, m2:MovieClip) {
          if (m1.id == m2.id) {
          // they match!
          } else {
          // they don't!
          }

          }

          This is just the basic idea but should get you started.

          Tim