Simple Drag and Drop

Here is a very simple method to allow you to drag and drop object around the stage.

Open a new Flash movie. Choose Insert -New symbol and create a new movie (CTRL F8). Within the movie, create the object to be moved.

Select this object and choose Insert-Convert to Symbol (F8). Make it a button. (You have now made a movie clip with an embedded button.)

Right click the button and choose Action. Enter the following action script. (You may want to choose Expert Mode. If not, choose the Evaluate action and much of the hard work will be done for you.)

Action Script to go on the button (not the movie!)

on (press) {
startdrag("",true);
}on (release, releaseOutside) {
stopdrag();
}

Return to the main sceene and test the movie. You will find you can drag and drop the object around the screen.

Here is a sample


Last updated 06-Nov-2003

© Mike Leishman Nov 2003