Specifying the package
Define your custom components within an ActionScript package. The package reflects the
directory location of your component within the directory structure of your application.
package myComponents
{
// Class definition goes here.
}
Defining the class
The class definition must be prefixed by the
// Class definition goes here.
public class MyButton extends Button {
// Define properties, constructor, and methods.
}
Defining the constructor
If the class is missing a constructor, add it. A constructor for a child class of UIComponent
must have no required arguments; it can only have optional ones.
Here is a typical constructor:
public function Button() {
super();
className = "Button";
btnOffset = 0;
}
Creating bindable properties
In Flex 1.5, you use the
2.0, you use the
[Bindable]
Flex 2 Components.
162
Customizing Components
public
metadata tag to define a property as bindable. In Flex
[ChangeEvent]
metadata tag. For more information, see Creating and Extending
keyword, as the following example shows:
Need help?
Do you have a question about the FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 and is the answer not in the manual?
Questions and answers