description:In
this tutorial you will learn how to make a draggable object.
Files:The drag_me.fla
file is in the fla_files folder.
step 1:Create
an object on the stage, Convert to Symbol (F8), select Movie Clip as
the Behavior, then name your Movie Clip Instance in the Properties Panel
(one word, lower case).(Figure
A)
A
step 2:Double-Click on
the instance to edit the symbol, Insert > Layer, and create a similarly
sized object on the stage with no stroke. Convert it to a symbol (Button),
Double-Click to edit the Symbol, and create an invisible button by dragging
the keyframe to the Hit State. Then position the invisible button over
the movie clip object as shown. (Figure
B)
B
step 3:Window > Actions
(F9), click on the button if necessary so the Action is set to Button,
and follow the steps shown in the following movie. (Figure
C)
C
step 4:Command-Return to
Test Movie. (Figure
D)
D
step 5:To constrain the
area in which one may drag your object, set the limits in the Actions
Panel (F9). Remember that the upper left corner of your stage is 0, 0.
If you want the cursor to snap to the center of the draggable object,
tick that check box. (Figure
E)
E
step 6:Command-Return to
see the constrained version. (Figure
F)