3 Replies Latest reply on Dec 10, 2007 1:30 PM by Some1Won

    quick question (why is this happening)

    graphicanthem
      i'm working on a draggable background with boundaries and had a quick question for you guys that know way more than me about actionscript... any help will be greatly appreciated.

      i have a draggable movie clip and set up boundaries for it, and they all work except for when you drag the MC to the extreme left/bottom corner... the left boundary stops working as soon as it hits that direct corner..

      see for yourself: http://www.liquid-creative.com/testing.php

      my code is below... any thoughts?


        • 1. Re: quick question (why is this happening)
          Some1Won Level 1
          Hm, instead of doing coding this, you could use the startDrag() method. You can specify left, top, bottom, right parameters for drag boundaries. Use stopDrag() to…well, stop dragging.
          • 2. Re: quick question (why is this happening)
            graphicanthem Level 1
            i tried startDrag() but wasn't able to successfully code the inertia for when the MC is released. i'm a designer learning actionscript, therefore a lot of what i've discovered has been by trial and error.

            could you recommend any tutorials for adding the inertia to the startDrag() method?

            i feel like it should be a little more simple than what i keep coming up with... thanks.
            • 3. Re: quick question (why is this happening)
              Some1Won Level 1
              hm... well I think what you really need to get out of the dragging step is the vector of the object when the object is ‘released’?

              I suppose you could use the actual startDrag()/stopDrag methods to do the dragging work for you and then add on to it. Perhaps while the mouse is moving, keep track of (and update) the values/vector of where the mouse was 1 ‘movement unit’ before (1 frame before I presume), then when stopDrag() is called, at the same spot, subtract the current vector from the vector stored and use the result for calculating inertia.

              (Note that I don’t have flash in front of me so this actually coming from my head, -someone may have a better method)