6 Replies Latest reply on Jul 25, 2009 10:32 PM by kglad

    puzzling puzzle problem

    christoon_ca

      Hey all

       

      So I have a puzzle that doesn't want to work properly. I have it setup so when all six pieces are dragged onto their respective spots, the movie goes to frame 2, but when I drag all the pieces properly and the scores add up to 6, the action of going to frame 2 doesn't occur, but if I pull a piece off, and the score equals 5 the action occurs!?!?!?!?!?!

       

      There are 6 pieces named tl, tm, tr, bl, bm, br and those get dragged onto their 6 respective mcs (drag_tl etc.).

       

      I have no idea why this is happening. Any help would be appreciated.

      Thanks

       

      Here's the link: superbean_puzzle

       

      ...one more thing, is there a way to make the link disply at 100% instead of full screen?

       

      Thanks some more

       

      stop();
      
      
      // Cursor //
      onMouseMove = function () {
           updateAfterEvent();
      }
      onEnterFrame = function() {
           counter.text = ((scoretl + scoretm + scoretr + scorebl + scorebm + scorebr) + "/6");
           if (scoretl + scoretm + scoretr + scorebl + scorebm + scorebr == 6) {
                gotoAndPlay(2);
                }
           Mouse.hide();
           curs._x = _xmouse;
           curs._y = _ymouse;
      };
      
      onMouseDown = function() {
           curs.gotoAndStop(2);
      };
      onMouseUp = function() {
           curs.gotoAndStop(1);
      };
      
      pieceArr = Array()
      pieceArr[0] = "tl";
      pieceArr[1] = "tm";
      pieceArr[2] = "tr";
      pieceArr[3] = "bl";
      pieceArr[4] = "bm";
      pieceArr[5] = "br";
      
      dragArr = Array()
      dragArr[0] = "drag_tl";
      dragArr[1] = "drag_tm";
      dragArr[2] = "drag_tr";
      dragArr[3] = "drag_bl";
      dragArr[4] = "drag_bm";
      dragArr[5] = "drag_br";
      
      var scoretl = 0;
      var scoretm = 0;
      var scoretr = 0;
      var scorebl = 0;
      var scorebm = 0;
      var scorebr = 0;
      
      for(i=0; i<pieceArr.length; i++)
      (_root[pieceArr[i]]).onPress = function() {
           startDrag(this);
      };
      for(i=0; i<pieceArr.length; i++)
      (_root[pieceArr[i]]).onRelease = function() {
           stopDrag();
           checkTarget(this);
      };
      
      function checkTarget(drag) {
           if(tl.hitTest(drag_tl)) {
                setProperty(tl,_x, 256);
                setProperty(tl,_y, 186);
                     if (scoretl == 0) {
                          scoretl = 1;
                     }
           } else {scoretl = 0}
                //trace("1 " + scoretl);
           if(tm.hitTest(drag_tm)) {
                setProperty(tm,_x, 353);
                setProperty(tm,_y, 203);
                     if (scoretm == 0) {
                          scoretm = 1;
                     }
           } else {scoretm = 0}
                //trace(scoretm);
           if(tr.hitTest(drag_tr)) {
                setProperty(tr,_x, 463);
                setProperty(tr,_y, 203);
                     if (scoretr == 0) {
                          scoretr = 1;
                     }
           } else {scoretr = 0}
                //trace(scoretr);
           if(bl.hitTest(drag_bl)) {
                setProperty(bl,_x, 257);
                setProperty(bl,_y, 280.5);
                     if (scorebl == 0) {
                          scorebl = 1;
                     }
           } else {scorebl = 0}
                //trace(scorebl);
           if(bm.hitTest(drag_bm)) {
                setProperty(bm,_x, 370);
                setProperty(bm,_y, 298);
                     if (scorebm == 0) {
                          scorebm = 1;
                     }
           } else {scorebm = 0}
                //trace(scorebm);
           if(br.hitTest(drag_br)) {
                setProperty(br,_x, 479.5);
                setProperty(br,_y, 297.5);
                     if (scorebr == 0) {
                          scorebr = 1;
                     }
           } else {scorebr = 0}
                //trace(scorebr);
      };