Name

stopDrag( ) Global Function — end a drag operation in progress

Availability

Flash 4 and later

Synopsis

stopDrag( )

Description

The startDrag( ) function causes a movie clip to follow the mouse pointer around the Stage. A stopDrag( ) operation stops a dragging movie clip from following the mouse pointer. Because only one movie clip or movie may be dragged at a time, stopDrag( ) does not require a target argument; it simply cancels any drag operation in progress.

Together with startDrag( ), stopDrag( ) is used to create simple drag-and-drop interfaces in Flash, as demonstrated under “Interface Widgets” in the online Code Depot.

Example

The following button code causes a movie clip to be dragged while the button is pressed and dropped when the button is released:

on (press) {
  startDrag("", true);
}

on (release) {
  stopDrag( );
}

See Also

MovieClip.stopDrag( ), startDrag( ), String.toLowerCase( ) ; Section 4.6.8.1 in Chapter 4

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.