Flash Tutorials > Flash 5 - Moveable Layers

Adobe Flash CS3 Professional
Flash CS3 introduces many new and exciting features and delivers an entirely new experience in Flash dev.
Adobe Flash CS3
Adobe Creative Suite 3
Streamline your web dev with a collection of Adobe software including the new Flash CS3 Pro.
Adobe Creative Suite 3
Step 1

You first need to create the actual area you want to be draggable. Go to Insert > New Symbol > Movie Clip, and name it drag layer. Select the Rectangle tool and draw out the full area that will contain your content. Leave enough area at the top for the clickable area (essentially the "Title Bar" of a window).

Step 2

Still inside the MC stage, create a new Layer, Insert > Layer. With the Rectangle tool, draw out an area along the top of the other area you made in Step 1. This will be what you click to move the entire area. Select this area and make it a Button Symbol, Insert > Convert to Symboland select Button for the Behavior. Name it drag area.

Step 3

Right click on your button, drag area, and click Actions. From that window click the + button and from the 2nd menu, Actions >, choose startDrag. Next, click the + button again, and from the Actions > menu, select stopDrag.

You should end up with this:

on (press) {
   startDrag ("");
}
on (release) {
  stopDrag ();
}


Step 4

Go back to your main stage, Scene 1, and from your library Ctrl + L, drag your MC, drag layer to your stage.

Step 5

Test your movie. Control > Test Movie or Ctrl + Enter. You should be able to click on the drag area button at the top of the layer and move the whole layer anywhere you drag it. If it doesn't work, please double check your steps.