In this tutorial I will show you how to create stars dancing animation using the action script code.
Step 1
Create a new flash document and set Frame rate to 45 fps (Frames per Second).
Preview
Step 2Take the Line Tool (N), and drag a little "star" like it is shown on the picture below.
Step 3Select the "star" and press F8 on the keyboard (Convert to Symbol) to convert it into a Movie Clip.
Step 4Double click on a new made Movie Clip ("star") to go in its inside.
Step 5Then, while your "star" is still selected, press again F8 on the keyboard (Convert to Symbol) and convert it into a Graphic Symbol.
Step 6Click on frame 7 and press F6 (Keyframe). Then click on frame 12 and frame 17 and press again F6. Look at the picture below!
Step 7Go back on frame 12, take the Free Transform Tool (Q), and decrease the "star" a little.
Step 8Click on frame 12, open the Properties Panel (Ctrl+F3), and under Tween choose Motion. Then, under Rotate choose CW and under Ease set 100. Look at the picture below!
Step 9Click on frame 7, and in Properties Panel under Tween choose again Motion. After that, under Rotate choose CCW and set Ease to 100.
Step 10Click on frame 25 and press F5.
Step 11Go back on main scene (Scene 1), Select the "star", open the Action Script Panel (F9), and paste this script:
onClipEvent(enterFrame){
if(random(25)==1){
num=random(25);
}
this.gotoAndPlay(num);
}
Step 12Select again the "star" and press Ctrl+D on the keyboard few times to Duplicate it. See the picture below.
Step 13Then, set the "stars" in the position which you like.
Test your Movie (Ctrl+Enter).
We're done!
Download source file (.fla)