[Inspectable(defaultValue="default text")]
function set text(t:String)
}
You can use any of the following types for parameters:
•
Array
•
Object
•
List
•
String
•
Number
•
Boolean
•
Font Name
•
Color
Note: The JellyBean class is a theoretical example. To see an actual example, look at the Button.as
class file that installs with Flash MX 2004 in the First Run/Classes/mx/controls directory.
Defining core functions
You must define five functions in the component class file: the constructor,
createChildren()
in the class file are called in the following order:
•
Constructor
•
init()
Once
init()
•
createChildren()
A frame passes in the Timeline. During this time, the component user can call methods and
properties to set up the component.
•
draw()
•
The
method is called whenever a component is resized at runtime.
size()
Defining the constructor function
You can recognize a constructor because it has the same name as the component class. For
example, the following code shows the ScrollBar component's constructor function:
function ScrollBar() {
}
In this case, when a new scroll bar is instantiated, the
Generally, component constructors should be empty. Setting properties in constructors can
sometimes lead to overwriting default values, depending on the order of initialization calls.
944
Chapter 7: Creating Components
,
, and
draw()
size()
is called, the
and
width
. When a component extends UIComponent, functions
properties are set.
height
ScrollBar()
,
init()
constructor is called.
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?