User Guide
456 Chapter 6: Components Dictionary
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”
on page 71.
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 647 and “Using skins with the UIScrollBar component” on page 831.
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.
A row is a component that is used to display an item. Rows are either supplied by default by the
list (the SelectableRow class is used), or you can supply them, usually as a subclass of the
SelectableRow class. The SelectableRow class implements the CellRenderer API, which is the set
of properties and methods that allow the list to manipulate each row and send data and state
information (for example, size, selected, and so on) to the row for display.
A data provider is a data model of the list of items in a list. Any array in the same frame as a list is
automatically given methods that let you manipulate data and broadcast changes to multiple
views. You can build an Array instance or get one from a server and use it as a data model for
multiple lists, combo boxes, data grids, and so on. The List component has methods that proxy to
its data provider (for example,
addItem() and removeItem()). If no external data provider is
provided to the list, these methods create a data provider instance automatically, which is exposed
through
List.dataProvider.