Your Ad Here

December 10, 2009

Dragging

Reactions: 
Name : Dragging in Macromedia Flash
Category: Beginner

In Flash, we use dragging to move objects around. Here also we will learn how to move an object in Flash by using Action script.



1- Open Macromedia Flash and create new file.

2- On the workspace draw a circle.











3- Select the circle and set its x and y coordinates to zero.










4- Right Click on the circle and select Convert to symbol

                                            OR
    Same result can be achieved by pressing F8 Key, while the circle is still selected.

5- Name the symbol as "ball"(or any desired name you want). Set the type as Movie clip.









6- Now select the "ball" Movie clip and open the Actions panel (can be achieved by pressing F9 key, while the movie clip is still selected). This will edit the actions of the "ball" movie clip. Write the actions:


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


7- All Done. Now, close the Actions Panel and test the Movie by pressing Ctrl + Enter.

No comments:

Post a Comment

Please use sensible language.....!