4 Replies Latest reply on Nov 10, 2006 3:02 PM by mirianam

    Drag and Drop Behaviour

    mirianam Level 1
      I am using and modifying this script I found at Director Online. I get a problem at " pdlist = [:]" - debugger break.
      Can someone be kind enough to see what is wrong with it.
      It seems to work as expected if I ignore the error but obviously something is not right.

      Thank you for your help

      Miriana

        • 1. Re: Drag and Drop Behaviour
          mirianam Level 1
          oops
          here is code

          -- Behaviour by Pat McClallan
          -- This behaviour allows a sprite to be moved around the stage
          -- On mouseUp, the sprite will compare its loc to its targetLoc.
          -- If it is within the acceptable range, then the sprite will lock into place.

          global gScore

          property pMySprite
          property pTargetH
          property pTargetV
          property pVariance
          property pTargetLoc -- point(pTargetH, pTargetV)
          property pStatus -- #inPlace or #notInPlace

          property pAmount



          on getPropertyDescriptionList me
          pdlist = [:]
          addprop pdlist, #pTargetH, [#comment: "Target locH", #format: #integer, #default: 500]
          addprop pdlist, #pTargetV, [#comment: "Target locV", #format: #integer, #default: 378]
          addprop pdlist, #pVariance, [#comment: "Acceptable Variance", #format: #integer, #default: 100]
          addprop pdlist, #pAmount, [#comment: "How much score?", #format: #integer, #default: 10]
          return pdlist
          end getPropertyDescriptionList

          on beginSprite me
          pMySprite = sprite(me.SpriteNum)
          pMySprite.moveableSprite = TRUE
          pTargetLoc = point(pTargetH, pTargetV)
          pStatus = #notInPlace

          gScore = 0

          testLoc me
          end

          on mouseUp me
          testLoc
          sound(3).play(member("shrtwhs"))

          end

          on testLoc me
          testH = pMySprite.locH
          testV = pMySprite.locV
          if abs(pTargetH - testH) < pVariance then
          if abs(pTargetV - testV) < pVariance then
          pMySprite.loc = pTargetLoc
          pMySprite.moveableSprite = False
          pStatus = #inPlace

          updateStage
          end if
          end if

          if pMySprite.loc = pTargetLoc then
          gScore = gScore + pAmount
          if gScore = 55 then
          sprite ("no_jump").loc = point(235,27)
          sound(4).play(member("BellTransition"))
          end if
          end if
          end
          • 2. Re: Drag and Drop Behaviour
            duckets Level 1

            A debugger breakpoint is something you specify by clicking in the line number margin in the script window. You should see a small red circle by that line in the script window. Click on it to turn off the breakpoint, and your movie should run fine.

            hope this helps,

            - Ben
            • 3. Re: Drag and Drop Behaviour
              Level 7
              In addition to what Ben said, you can also choose Control > Remove All
              Breakpoints from the top menu, if you have multiple breaks.

              --
              Dave -
              Head Developer
              www.blurredistinction.com
              Adobe Community Expert
              http://www.adobe.com/communities/experts/


              • 4. Re: Drag and Drop Behaviour
                mirianam Level 1
                Thank you so very much to both of you.
                Yes it helps very much.
                Miriana