Through the power of inheritance, Darron will show you how to customize components to add or modify functionality with a minimal amount of code and effort. Two components will be demonstrated, with their full source code provided to attendees.
First, the List component based on the v2 component framework that ships with Flash MX 2004 will be extended and transformed into a DraggableList. This will allow users to drag items into and out of the list, enabling a commonly-requested feature by Flash developers.
Second, the TextInput component (another v2 component) will be extended to create a FormattedTextInput component. This component will allow the developer to specify a format mask that restricts the input of the user to match format of the specified mask, allowing for easier form validation. For example, a format mask of “##U#-LL” will only accept user input that matches the pattern of 2 numbers, an uppercase letter (automatically converted to uppercase), a number, a dash (automatically inserted) and two lowercase letters (automatically forced to lowercase). If the user types a number when an uppercase is expected, the FormattedTextInput will not register the key stroke.
In both cases, the majority of the grunt work for the component has already been provided by the creator of the original. Through inheritance, we can re-use all of the base code and simply provide methods to enable enhanced functionality, resulting in a very fast time to market and less developmental efforts.