User Guide

934 Chapter 7: Creating Components
The following table describes these variables:
The following example adds the
symbolName, symbolOwner, and className variables to the
MyButton class:
class MyButton extends mx.controls.Button {
static var symbolName:String = "MyButton";
static var symbolOwner = myPackage.MyButton;
var className:String = "MyButton";
}
Defining variables
The following code sample is from Button.as file (mx.controls.Button). It defines a variable,
btnOffset, to use in the class file. It also defines the variables __label, and __labelPlacement.
The latter two variables are prefixed with a double underscore to prevent name conflicts when
they are used in getter/setter methods and ultimately used as properties and parameters in the
component. For more information, see “Using getter/setter methods to define parameters
on page 935. See also “Implicit getter/setter methods” in Using ActionScript in Flash.
/**
* Number used to offset the label and/or icon when button is pressed.
*/
var btnOffset:Number = 0;
*@private
* Text that appears in the label if no value is specified.
*/
var __label:String = "default value";
/**
*@private
* default label placement
*/
var __labelPlacement:String = "right";
Variable Type Description
symbolName
String The name of the ActionScript class (for example, ComboBox).
This name must match the symbol’s Linkage Identifier.
This variable must be static.
symbolOwner
Object The fully qualified class name (for example, mypackage.MyComponent).
Do not use quotation marks around the
symbolOwner value, because is is
an Object data type.
This name must match the AS 2.0 class in the Linkage Properties dialog
box.
This variable is used in the internal call to the
createClassObject()
method.
This variable must be static.
className
String The name of the component class. This does not include the package
name and has no corresponding setting in the Flash development
environment.
You can use the value of this variable when setting style properties.