|
|
Picture rotation by action script - ActionScript Webmaster Tips, Knowledge Base Webmaster Tools
| Home > ActionScript > Picture rotation by action script | |
| | Category | : ActionScript | | Written by | : Admin | | Date | : 2008-11-10 | | Rating | : 0 | Voted : 0 times | | Hit | : 428 | | | | |
| 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).
|
|