User Guide
144 Creating Components
function init():Void {
super.init();
boundingBox_mc.width = 0;
boundingBox_mc.height = 0;
boundingBox_mc.visible = false;
}
function createChildren():Void{
// Call createClassObject to create subobjects.
size();
invalidate();
}
function size(){
// Write code to handle sizing.
super.size();
invalidate();
}
function draw(){
// Write code to handle visual representation.
super.draw();
}
}
Overview of a component class file
The following is a general procedure that describes how to create an ActionScript file for a
component class. Some steps may be optional, depending on the type of component
you create.
To write a component class file:
1. (Optional) Import classes. (See “Importing classes” on page 146).
This allows you to refer to classes without writing out the package (for example, Button
instead of mx.controls.Button).
2. Define the class using the class keyword; use the extend keyword to extend a parent class.
(See “Defining the class and its superclass” on page 146).
3. Define the symbolName, symbolOwner, and className variables. (See “Identifying the
class, symbol, and owner names” on page 147).
These variables are necessary only in version 2 components.