
17ADOBE FLEX 3
Creating and Extending Adobe Flex 3 Components
In the following example, you define a constructor that uses super() to call the superclass’ constructor:
package myComponents
{
// Import necessary classes
import mx.core.Container;
import mx.controls.Button;
// Import all classes in the mx.events package
import mx.events.*;
// Class definition goes here.
public class MyButton extends Button {
// Public constructor.
public function MyButton()
{
// Call the constructor in the superclass.
super();
}
// Define properties and methods.
}
}
Note: You cannot define a constructor for an MXML component. For more information, see “About implementing
IMXMLObjec ...