Each class can contain only one constructor method; overloaded constructor methods are not
supported in ActionScript 2.0.
Implementing the init() method
Flash calls the
init()
should call the superclass's
until after this method is called.
function init(Void):Void {
super.init();
invalidate();
}
Note: Do not create child objects in the
properties.
This
method calls the
init()
that just the visuals for the object have changed, but the size and position of subobjects have not
changed. The
invalidate()
Implementing the createChildren() method
Components implement the
components) in the component. Rather than calling the subobject's constructor in the
createChildren()
subobject of your component.
The
createClassObject()
createClassObject(
The following table describes the arguments:
Argument
className
instanceName
depth
initObject
To call the
createClassObject()
a border or a button that you always need), because you must specify the name and type of the
object, plus any initialization parameters in the call to
The following example calls the
use inside a component:
createClassObject(Label, "label_mc", 1); // Create a label in the holder
You set properties in the call to the
argument. The following example sets the value of the
initObject
createClassObject(CheckBox, "cb", 0, {label:"Check this"});
You can also pass style properties within the
createClassObject(CheckBox, "cb", 0, {label:"Check this", fontSize : 14});
method when the class is created. At a minimum, the
method. The
init()
init()
invalidate()
method calls the
createChildren()
method, you call the
createClassObject()
method has the following signature:
,
Type
Object
String
Number
Object
method, you must know what those children are (for example,
createClassObject()
createClassObject()
and
width
height
method. You should use it only for setting up initial
method. The
invalidate()
method.
draw()
method to create subobjects (such as other
,
,
Description
The name of the class.
The name of the instance.
The depth for the instance.
The object that contains the initialization properties.
createClassObject()
method to create a new Label object for
method by adding them as part of the
argument, as the following example shows:
initObj
Writing the component's ActionScript code
method
init()
of the component are not set
method signals to Flex
method to instantiate a
)
.
property:
label
9
Need help?
Do you have a question about the FLEX-CREATING ADVANCED COMPONENTS and is the answer not in the manual?