Name

startDrag( ) Global Function — make a movie or movie clip follow the mouse pointer

Availability

Flash 4 and later

Synopsis

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

Arguments

target

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).

lockCenter

A Boolean indicating whether the target’s registration point should be centered under the mouse pointer (true) or dragged relative to its original location (false).

left

A number specifying the minimum x-coordinate to the left of which target’s registration point may not be dragged.

top

A number specifying the minimum y-coordinate above which target’s registration point may not be dragged.

right

A number specifying the maximum x-coordinate to the right of which target’s registration point may not be dragged.

bottom

A number specifying the maximum y-coordinate below which target’s registration point may not be dragged.

Description

The startDrag( ) function causes target to visually follow the mouse pointer around in the Player (known as dragging the clip). The movement of a dragging 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 ...

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.