2 Replies Latest reply on Dec 8, 2008 12:20 AM by Newsgroup_User

    drag to an specific position

    Level 7
      I need to make a clock where the hour arrow can be drag to fixed position of
      one o'clock, two o'clock... and backwards from 12 o'clock to 11 o'clock, 10

      Can you help me to do this please?
      thank you very much

        • 1. Re: drag to an specific position
          James Newton, ACP Level 3
          Here are my steps for doing this:

          1) Create a vectorShape member to represent a clock hand facing 12 o'clock
          2) Drag this onto the Stage
          3) Use Window | Library Palette to open the Library Palette window
          4) Select the Animation | Interactive pane
          5) Drag the "Drag to Rotate" behavior onto your vectorShape sprite
          6) A copy of the "Drag to Rotate" behavior will have been copied to your movie cast. Open this in the Script editor.
          7) Replace the existing "on StopDrag" handler with the following:

          on StopDrag me
          myMouseDown = FALSE
          sendAllSprites #Active_Sprite, myMouseDown

          vRotation = mySprite.rotation
          vRotation = integer(vRotation / 30.0) * 30
          mySprite.rotation = vRotation
          end StopDrag

          8) Launch your movie.
          9) Click on the hour hand and drag it round. When you release it, it will jump to point at the nearest hour.
          • 2. Re: drag to an specific position
            Level 7
            Thank you very much for your time and help.