Working with Movie Clips and Buttons > Using actions and methods to control movie clips > Dragging movie clips

 

Dragging movie clips

You can use the startDrag action or method to make a movie clip draggable while a movie is playing. For example, you can make a draggable movie clip for games, drag-and-drop functions, customizable interfaces, scroll bars, and sliders.

A movie clip remains draggable until explicitly stopped by stopDrag, or until another movie clip is targeted with startDrag. Only one movie clip can be dragged at a time.

To create more complicated drag-and-drop behavior, you can evaluate the _droptarget property of the movie clip being dragged. For example, you might examine the _droptarget property to see if the movie was dragged to a specific movie clip (such as a "trash can" movie clip) and then trigger another action. For detailed information, see startDrag or MovieClip.startDrag in the ActionScript Dictionary.