Jump to content
xisto Community
Sign in to follow this  
mamer

Simple Flash Actionscript Animation In 3 Lines

Recommended Posts

In this short tutorial I'm going to show you a very basic flash animation of a fan, just in 3 lines.

 

Assumed knowledge:

Familiarity with Flash Professional interface and drawing tools


1- Open Flash Professional

 

2- Click File>New and select Flash File (ActionScript 3.0)

 

Posted Image

 

3- Use the drawing tools (brush or oval) to draw a fan shape

 

Posted Image

 

4- Select the shape you just drew and hit F8 to convert it to a movieclip, give it a name

and make sure the registeration point is in the center, click OK

 

Posted Image

 

5- After clicking OK, the the movieclip you created needs an instance name. Select it and click PROPERTIES or hit Ctrl+F3 to open the properties window. Give it a name "fan"

 

Posted Image

 

Now for the code.

 

6- Select the first frame and open the ACTIONS window by hitting F9

 

Posted Image

 

7- in the actions window type the following (notice the comments on the code after a //:)

 

Posted Image

 

//This line means: every time the movieclip enter frame event hapens the function "rotatefan" runs

 

fan.addEventListener(Event.ENTER_FRAME, rotateFan);

 

function rotateFan(e:Event):void{

//This line means rotating the fan around the registeration point(center in our case) 3 degrees clockwise

fan.rotation += 3;

}

 

//end of code

8- Save your fla and hit Ctrl+Enter to run compike and run.

 

Note: You could change the speed by increasing the rotation value.

 

The compiled swf could be found here

The source fla could be found here

 

I hope that helps introducing a beginner to flash actionscript animation

 

Comments are most welcome


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.