18.5.2006, 11:18
Submited in: Flash | Total Views: 71377

This tutorial will teach you how to apply spin on any object in Flash using  the Action Script. You will also learn how to duplicate object many times and more.


Step 1

Open a new Flash document. Select Modify > Document (shortcut key: Ctrl+J). Then, for Frame rate choose 60 fps and press ok. See the picture below.

Step 2

Draw any object on the stage, select it, press F8 key (or select Modify > Convert to Symbol) to convert that object into a Movie Clip symbol.

Step 3

Take the Selection Tool (V), double click on a new made Movie Clip or choose right click and Edit in place. After that, while the object is still selected press again F8 key (Convert to symbol) and convert it again into a Movie Clip Symbol.

Step 4

Then, open the Action Script Panel (F9) and paste this script:

onClipEvent (load) {
pointX = _parent._x;
pointY = _parent._y;
onClipEvent (enterFrame) {
distanceX = _root._xmouse-_parent._x;
distanceY = _root._ymouse-_parent._y;
if (distanceX < 0) {
distanceX = -distanceX;
if (distanceY < 0) {
distanceY = -distanceY;
distance = Math.sqrt((distanceX*distanceX)+(distanceY*distanceY));
if (distance <160 and distance >-160) {
_parent._rotation = _parent._rotation + (distance/2);
onClipEvent (mouseMove) {

Step 5

Go back on the main scene (Scene 1) and duplicate your object like it is shown on the picture below.

we're done!


Download example (72 KB)

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category

Most popular tutorials