Display objects classes

Display list

The DisplayObject class is the base class for all objects that can be placed on the display list. The display list manages all objects displayed in the Flash runtimes (the timeline /s).
We are refering to the animation and design pieces that traditionally you have used on keyframes: the visual content of the project. Look at the different flash visual objects and their structure: a Movieclip belongs to the Sprite class, that belongs to a Display object container, that belongs to an Interactive object.

How to call movieclips and buttons from the library with AS3.0

When you manage a project with ActionsScripting you don't place much of the content on the timeline: You call movieclips and buttons from the Library directly, without having to place them onStage. To do so, you have to NAME the object first (since the object is not on Stage and cannot be named in properties, as we usually do). From the libray, selesct the object, find the Little Icon at the Right ofthe Libbary window, choose "Symbol Properties". Click on Advanced, click on "Export for ActionScript", enter a name in the field that says "Class". That name that you enter will become the name of the object in the "AS linkage" section, on the left of the object's name in the library, and it will be passed on when you expoprt to swf, so it can be called by the code.

Name a library-symbol to be called by AS 3.0

OR Name a library-symbol for AS3 in the Linkage area

Instead of opening the symbol's properties, you can add the new class name in the Linkage area in the Library.

To create an instance of this element through code
(now your Library element behaving like a Class),
you need to wrap it in a variable and use this new class (kitty) as the variable type:

var moreCats : kitty = new kitty();
this.addChild(moreCats);
moreCats.x = mouseX + Math.random() *20;
moreCats.y = MouseY + Math.random() *12;

 

Notice that from now on, you will refer to your instance/s as the variable name (moreCats).

Notes

_An AVM1 is a simple class that represents movieclips or objects that use ActionScript 1.0 or 2.0
_A Bitmap is a JPEG, GIF or PNG either loaded from external files or renderd through ActionScript
_A Shape is a vector-based graphic such as a rectangle, ellipse, triangle, circle or line created through API drawing