startDrag( ) Global Function | Flash 4 |
make a movie or movie clip follow the mouse pointer |
A string or reference indicating the path to the movie or movie clip instance that should follow the mouse pointer (references to movie clips are converted to paths when used in a string context).
A Boolean indicating whether target's registration point should be centered under the mouse pointer (true) or dragged relative to its original location (false).
A number specifying the minimum x-coordinate to the left of which target's registration point cannot be dragged.
A number specifying the minimum y-coordinate above which target's registration point cannot be dragged.
A number specifying the maximum x-coordinate to the right of which target's registration point cannot be dragged.
A number specifying the maximum y-coordinate below which target's registration point cannot be dragged.
The startDrag( ) function causes target to follow the mouse pointer around in the Player visually (known as dragging the clip). The movement of a dragged clip can be constrained to a bounding box whose coordinates are provided as arguments to the startDrag( ) function. Bounding box coordinates are given relative to the canvas on which target resides. If that canvas is the main movie Stage, then (0,0) is the top-left corner of the Stage. If that canvas is a movie clip, then (0,0) is the registration point of the clip's canvas. Note that Flash's coordinate system reverses the Cartesian Y-axis; y values increase toward the bottom of the screen and decrease toward the top of the screen. Negative y values are above the origin (i.e., above the X-axis).
Dragging can be stopped at any time via the stopDrag( ) function. Only one movie clip or movie can be dragged at a time, so issuing a startDrag( ) function on a new target automatically cancels any drag operation already in progress. That said, when a movie or movie clip is dragged, all the movie clips it contains are dragged along with it.
// Drag ball, limiting its movement to the upper-left corner of the Stage startDrag("ball", true, 0, 0, 225, 200);
MovieClip._dropTarget, MovieClip.startDrag( ), stopDrag( )