General process for writing a class file

Use the following general process when writing the ActionScript for a component. Some steps may be optional, depending on the type of component you create.

This process is covered in more detail in the rest of this chapter.

To write the ActionScript file for a component:

  1. Import all necessary classes.
  2. Define the class using the class keyword; extend a parent class, if necessary.
  3. Define the symbolName and symbolOwner variables; these are the symbol name of your ActionScript class and the fully qualified package name of the class, respectively.
  4. Define your class name as the className variable.
  5. Add versioning information.
  6. Enter your default member variables.
  7. Create variables for every skin element/linkage used in the component. This lets users set a different skin element by changing a parameter in the component.
  8. Add class constants.
  9. Add a metadata keyword and declaration for every variable that has a getter/setter.
  10. Define uninitialized member variables.
  11. Define getters and setters.
  12. Write a constructor. It should generally be empty.
  13. Add an initialization method. This method is called when the class is created.
  14. Add a size method.
  15. Add custom methods or override inherited methods.