Implementing the initialization method

Flash calls the initialization method when the class is created. At a minimum, the initialization method should call the superclass's initialization method. The width, height, and clip parameters are not properly set until after this method is called.

The following sample initialization method from the Button class calls the superclass's initialization method, sets the scale and other default property values, and gets the value for the color attribute from the UIObject object:

function init(Void):Void {
  super.init();
  labelField.selectable = false;
  labelField.styleName = this;
  useHandCursor = false;
  // mark as using color "color"
  _color = UIObject.textColorList;
}