Skip to main content
Known Participant
August 2, 2011
Answered

Draggable movieclip within the x and y axis of another movieclip

  • August 2, 2011
  • 2 replies
  • 597 views

I know that startDrag function allow a movieclip to be draggable on the stage. But what I'm trying to achieve here is that I want that certain movieclip to be draggable on a limited space. I attach a screenshot for further information.

Above is a screeshot of the flash movie. The white area is the stage and the green square is the draggable movieclip while the gray rectangle is its draggable limit.

Any response is highly appreciated.

This topic has been closed for replies.
Correct answer Ned Murphy

If you look further into the startDrag function in the Help documentation you will see that it includes parameters that you can specify to limit the areas in which in can be dragged.

   startDrag(target, lock, left, top, right, bottom)

If you intend no movement in the _y direction, then you would specify the same values for the top and bottom parameters

2 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
August 2, 2011

If you look further into the startDrag function in the Help documentation you will see that it includes parameters that you can specify to limit the areas in which in can be dragged.

   startDrag(target, lock, left, top, right, bottom)

If you intend no movement in the _y direction, then you would specify the same values for the top and bottom parameters

Known Participant
August 2, 2011

I already read the documentation about the startDrag function but it did'nt explain how to get the specific left, top, right and bottom value of the a movieclip that makes the draggable area.

I try to change the said parameters in startDrag function but I did'nt get the exact values to make my square movieclip draggable only on the area of the rectangle movieclip.

I know I'm still around the bushes but somehow I know I'm on the right direction.

Thanks for the reply guys,

relaxatraja
Inspiring
August 2, 2011

http://www.kirupa.com/developer/mx/slider.htm