Creating a class from a drawing

In this tutorial you will learn how to how to draw a circle and create a class from an drawing in Flash CS4. You will also learn object-oriented features of ActionScript 3.0 and the correct approach to design a solution.

Steps for creating a class from an drawing (graphics object) in Flash CS4
1. Create a New Document choose Flash file (ActionSceipt 3.0) as shown below



2. Choose Oval Tool (by clicking on Rectangle tool and selecting Oval tool from the menu)


3. Rright click on the cricle and choose "Convert to Symbol..."
4. Convert to Symbol dialog window appears.
5. Click on Advanced button to toggle the Advanced View


6. Provide a name to the Symbol (say Circle) , choose "Movie Clip" as Type, select "Export to ActioScript" and click OK button, it should now be added to the library.

7. You can instantiate the objects of the class from the library by draging it into the stage.
Provide each circle an instance name by going to the properties panel.


8 You can now refer to the instance in ActionScript using the instance name. Now you can modify the properties of an graphics object using ActionScript.

Rules to name an instance
  • cannot contain spaces
  • can't start with number
  • special characters are not allowed except underscore ( '_' ).
Now we are ready to modify the properties of the object (instance) using ActionScript in Flash

Watch this video below to understand this better.



Reblog this post [with Zemanta]


More Resource on ActionScript:
ActionScript 1-on-1

Comments

Popular posts from this blog

What is Adobe Flash ?

Prototype based programming