How to Drag and Drop in Flash

Draw the object you want to be dragged and dropped., Select the object and convert it to a Movie Clip., Select your created Movie Clip and give it an Instance Name., Create a new layer, and add ActionScript to it.

5 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Draw the object you want to be dragged and dropped.

    This is the object you will drag and drop.

    For the example, I used the Earth.

    Also, raise the FPS from 12 to
    24.
  2. Step 2: Select the object and convert it to a Movie Clip.

    Select the object by using the Selection Tool or click on the frame the object is one.

    Press F8 to convert the object to a Symbol.

    Call it however you want, but make sure it's a Movie Clip and that the Registration is centered. , Pick the Selection Tool and select the Movie Clip.

    On the bottom menu you will find a box called "Instance Name" under the "Movie Clip" Drop-down Menu.

    Instance Name is a name of a Movie Clip the code (ActionScript) will use to know that this is the object you're talking about.

    So the Instance Name should be really what you just drew, and only in lowercase letters. , Create a new Layer using the New Layer button on the bottom of the timeline.

    Click on the empty keyframe.

    After it's selected, press F9.

    This will bring up the ActionScript menu.

    There, copy and paste the following code:
    INSTANCENAME.onPress = function(){ StartDrag(this,true) } INSTANCENAME.onRelease = function(){ this.stopDrag(); } Make sure to replace INSTANCENAME with your Movie Clip's Instance name!
  3. Step 3: Select your created Movie Clip and give it an Instance Name.

  4. Step 4: Create a new layer

  5. Step 5: and add ActionScript to it.

Detailed Guide

This is the object you will drag and drop.

For the example, I used the Earth.

Also, raise the FPS from 12 to
24.

Select the object by using the Selection Tool or click on the frame the object is one.

Press F8 to convert the object to a Symbol.

Call it however you want, but make sure it's a Movie Clip and that the Registration is centered. , Pick the Selection Tool and select the Movie Clip.

On the bottom menu you will find a box called "Instance Name" under the "Movie Clip" Drop-down Menu.

Instance Name is a name of a Movie Clip the code (ActionScript) will use to know that this is the object you're talking about.

So the Instance Name should be really what you just drew, and only in lowercase letters. , Create a new Layer using the New Layer button on the bottom of the timeline.

Click on the empty keyframe.

After it's selected, press F9.

This will bring up the ActionScript menu.

There, copy and paste the following code:
INSTANCENAME.onPress = function(){ StartDrag(this,true) } INSTANCENAME.onRelease = function(){ this.stopDrag(); } Make sure to replace INSTANCENAME with your Movie Clip's Instance name!

About the Author

G

George Edwards

Creates helpful guides on organization to inspire and educate readers.

44 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: