Toxiclab.org

Picture rotation by action script

31.7.2007, 2:19
Submited in: Flash | Total Views: 102075

In this little tutorial, you will see how to rotate image using the action script code. You can apply this code on any object, movie... in flash. You will be also learn how to convert picture into a Movie Clip Symbol, how to apply action script on it and more.



Example:



Step 1

First of all, find any picture which you want to rotate using the action script code.



Step 2


Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Select any color as background color. Set your Flash movie's frame rate to 100 and click ok.



Step 3

Choose File > Import > Import to Stage (Shortcut key:Ctrl+R). In the file explorer window that appears, find the picture that You will be use for this example and select it. Then click Open.

Step 4

While the picture is still selected, press F8 key (Convert to Symbol) to convert this picture into a Movie Clip Symbol.See the picture below.



Step 5

While the picture is still selected, go to the action script panel (F9) and enter this code inside the actions panel:

onClipEvent (enterFrame){
this.ang=ang+0.01;
_alpha=190*Math.sin(this.ang)+190;
_rotation++;
_xscale=260*Math.sin(this.ang)+1900;
}

Test your movie (Ctrl+Enter).

Bye!

Download example

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

Browse by category


Most popular tutorials


Resources Worth visiting


Friends