User Guide
770 List component
When creating a new class-level style declaration, you lose all default values provided by the
ScrollSelectList declaration. This includes backgroundColor, which is required for
supporting mouse events. To create a class-level style declaration and preserve defaults, use a
for..in loop to copy the old settings to the new declaration.
var source = _global.styles.ScrollSelectList;
var target = _global.styles.List;
for (var style in source) {
target.setStyle(style, source.getStyle(style));
}
To provide styles for the List component but not for components that extend List (DataGrid
and Tree), you must provide class-level style declarations for these subclasses.
import mx.styles.CSSStyleDeclaration;
if (_global.styles.DataGrid == undefined) {
_global.styles.DataGrid = new CSSStyleDeclaration();
}
_global.styles.DataGrid.setStyle("backgroundColor", 0xFFFFFF);
if (_global.styles.Tree == undefined) {
_global.styles.Tree = new CSSStyleDeclaration();
}
_global.styles.Tree.setStyle("backgroundColor", 0xFFFFFF);
For more information about class-level styles, see “Setting styles for a component class” in
Using Components.
Using skins with the List component
The List component uses an instance of RectBorder for its border and scroll bars for scrolling
images. For more information about skinning these visual elements, see “RectBorder class”
on page 1063 and see “Using skins with the UIScrollBar component” on page 1394.
List class
Inheritance MovieClip > UIObject class > UIComponent class > View > ScrollView >
ScrollSelectList > List
ActionScript Class Name mx.controls.List
The List component is composed of three parts: items, rows, and a data provider.
An item is an ActionScript object used for storing the units of information in the list. A list
can be thought of as an array; each indexed space of the array is an item. An item is an object
that typically has a
label property that is displayed and a data property that is used for
storing data.