User Guide

168 Creating Components
In addition, because of inheritance from the base classes, all components broadcast the
following events:
The following table describes common key events:
About assigning skins
A user interface (UI) component is composed entirely of attached movie clips. This means
that all assets for a UI component can be external to the UI component movie clip, so they
can be used by other components. For example, if your component needs check box
functionality, you can reuse the existing CheckBox component assets.
The CheckBox component uses a separate movie clip to represent each of its states (FalseUp,
FalseDown, Disabled, Selected, and so on). However, you can associate custom movie clips—
called skins—with these states. At runtime, the old and new movie clips are exported in the
SWF file. The old states simply become invisible to give way to the new movie clips. The
ability to change skins during authoring and at runtime is called skinning.
To skin components, create a variable for every skin element (movie clip symbol) used in the
component and set it to the symbols linkage ID. This lets a developer set a different skin
element just by changing a parameter in the component, as shown here:
var falseUpIcon = "mySkin";
UIComponent
event
Description
load
The component is creating or loading its subobjects.
unload
The component is unloading its subobjects.
focusIn
The component now has the input focus. Some HTML-equivalent
components (ListBox, ComboBox, Button, Text) might also broadcast
focus, but all broadcast DOMFocusIn.
focusOut
The component has lost the input focus.
move
The component has been moved to a new location.
resize
The component has been resized.
Key events Description
keyDown
A key is pressed. The code property contains the key code and the ascii
property contains the ASCII code of the key pressed. Do not check with
the low-level Key object, because the event might not have been
generated by the Key object.
keyUp
A key is released.