Circle ExampleFor explaining classes let's take a simple example of moving a circle to the right when the Right Arrow key is pressed. First task is to make a simple .fla document and a movieclip:- 1)Open your main flash program (which Iam hoping by now should be flash mx 2004 or higher) and create a new flash document(.fla). 2)Create a simple circle with the circle drawing tool and select the circle. 3)After selection, press F8 and select Movieclip and press ok to make it a MovieClip. 4)Look for the movie library, if it's not open then press Ctrl+L to open it. 5)Right click your circle MC(MovieClip) and then click on the 'Export for actionscript' radio button. 6)In the AS 2.0 class and in the instance name fields, write 'Circle' (without quotes, duh). 7)Select its properties and give it an instance name "circle_mc" (again, without the quotes). 8)Save your document for now, we will come back to it later.
Note: Be sure that of the case that you use in the MC instance, class name and file name, correctly. Here Iam using 'Circle' with an uppercase 'C' in the beginning.Next we will take a look at the .as file creation and creation of the 'class' inside it...
|» Level Intermediate|
Rating: 7 Votes: 9
|Iam a flash actionscript programmer.|
|Download the files used in this tutorial.|
|Download (0 kb)|
|More help? Search our boards for quick answers!|