Making objects moveable

 
     
 

Back

Next

 
     
 

You need to attach some ActionScript code to each word so that it responds to the mouse and can be dragged and dropped.

Click on one of the words to select it and then press F8 to bring up the actions pane.

Enter the following code.

on (press) {
startDrag(this,false);
}

on (release) {
stopDrag();
}

The first section is a function that responds to a mouse click over the word by moving the word with the mouse. When the mouse button is released, the second function is triggered and the word is dropped.

 

The top of the actions pane has a list box that lets you access the other objects in the movie to add code to them.

Copy the code from the words actions pane and then use the list box to switch to each other word. You can paste the code in without any modification.

Test the movie to find out if the words drag and drop as expected.

If the output window appears when you run the movie, there is a problem with the code. This is usually due to a simple typing error. The message in the window will give you a clue what to do about it.

accessing actions with the list box
   

Although the words can be moved about the screen, there is no feedback if they are dropped in the right place. The next section suggests one way that this could happen.

 
     
 

Back

Next