ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > MovieClip > startDrag (MovieClip.startDrag method) | |||
public startDrag([lockCenter:Boolean], [left:Number], [top:Number], [right:Number], [bottom:Number]) : Void
Lets the user drag the specified movie clip. The movie clip remains draggable until explicitly stopped through a call to MovieClip.stopDrag(), or until another movie clip is made draggable. Only one movie clip at a time is draggable.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Availability: ActionScript 1.0; Flash Player 5
lockCenter:Boolean [optional] - A Boolean value that specifies whether the draggable movie clip is locked to the center of the mouse position (true), or locked to the point where the user first clicked the movie clip (false).
left:Number [optional] - Value relative to the coordinates of the movie clip's parent that specify a constraint rectangle for the movie clip.
top:Number [optional] - Value relative to the coordinates of the movie clip's parent that specify a constraint rectangle for the movie clip.
right:Number [optional] - Value relative to the coordinates of the movie clip's parent that specify a constraint rectangle for the movie clip.
bottom:Number [optional] - Value relative to the coordinates of the movie clip's parent that specify a constraint rectangle for the movie clip.
The following example creates a draggable movie clip instance called mc_1:
this.createEmptyMovieClip("mc_1", 1);
with (mc_1) {
lineStyle(1, 0xCCCCCC);
beginFill(0x4827CF);
moveTo(0, 0);
lineTo(80, 0);
lineTo(80, 60);
lineTo(0, 60);
lineTo(0, 0);
endFill();
}
mc_1.onPress = function() {
this.startDrag();
};
mc_1.onRelease = function() {
this.stopDrag();
};
_droptarget (MovieClip._droptarget property), startDrag function, stopDrag (MovieClip.stopDrag method)
|
|
|
|