7 Replies Latest reply on May 22, 2009 9:04 PM by kglad

    Drag & Snap Puzzle Problem

    learner102

      Hi, this question is related to AS help given me yesterday.

       

      Basically I was instructed to put this code into my main timeline:

       

      function completedPuzzleCheck(){   // add this to your main timeline


      if(!numCompleted){

      numCompleted=1;

      } else {

      numCompleted++;

      }

      if(numCompleted==8){

      message.text="Great Job!";

       

       

       

      The code for the puzzle pieces (8 of them) was:

       

      function completedPuzzleCheck(){   // add this to your main timeline


      if(!numCompleted){

      numCompleted=1;

      } else {

      numCompleted++;

      }

      if(numCompleted==8){

      message.text="Great Job!";

      }

      }

       

      Button.prototype.swapDepths = MovieClip.prototype.swapDepths;
      TextField.prototype.swapDepths = MovieClip.prototype.swapDepths;
      Button.prototype.removeButton = MovieClip.prototype.removeMovieClip;
      // TextField already has removeTextField

      piece1.onPress = function () {
      piece1.swapDepths(-1000);
      };
      piece2.onPress = function () {
      piece2.swapDepths(-1000);
      };
      piece3.onPress = function () {
      piece3.swapDepths(-1000);
      };
      piece4.onPress = function () {
      piece4.swapDepths(-1000);
      };
      piece5.onPress = function () {
      piece5.swapDepths(-1000);
      };
      piece6.onPress = function () {
      piece6.swapDepths(-1000);
      };
      piece7.onPress = function () {
      piece7.swapDepths(-1000);
      };
      piece8.onPress = function () {
      piece8.swapDepths(-1000);
      };

       


      stop();

       

       

      It all works great but the issue (on a couple puzzles like this) is that a person could move one piece 8 times into the same correct position and the "Great Job" message will pop up although the puzzle is visualy incomplete.  Any suggestions to avoid this?   Again i am not a coder but a designer. Thank you.