Flash 8 Documentation |
|||
| Components Language Reference > List component > 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.
To add a List component to the tab order of an application, set its tabIndex property (see UIComponent.tabIndex). The List component uses the Focus Manager to override the default Flash Player focus rectangle and draw a custom focus rectangle with rounded corners. For more information, see Creating custom focus navigation in Using Components.
Each component class has a version property, which is a class property. Class properties are available only on the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code:
trace(mx.controls.List.version);
|
NOTE |
|
The code |
The following table lists methods of the List class.
|
Method |
Description |
|---|---|
|
Adds an item to the end of the list. |
|
|
Adds an item to the list at the specified index. |
|
|
Returns the item at the specified index. |
|
|
Removes all items from the list. |
|
|
Removes the item at the specified index. |
|
|
Replaces the item at the specified index with another item. |
|
|
Applies the specified properties to the specified item. |
|
|
Sorts the items in the list according to the specified compare function. |
|
|
Sorts the items in the list according to a specified property. |
The following table lists the methods the List class inherits from the UIObject class. When calling these methods, use the form listInstance.methodName.
|
Method |
Description |
|---|---|
|
Creates an object on the specified class. |
|
|
Creates a subobject on an object. |
|
|
Destroys a component instance. |
|
|
Calls a function when parameters have been set in the Property and Component inspectors. |
|
|
Gets the style property from the style declaration or object. |
|
|
Marks the object so it is redrawn on the next frame interval. |
|
|
Moves the object to the requested position. |
|
|
Forces validation of the object so it is drawn in the current frame. |
|
|
Resizes the object to the requested size. |
|
|
Sets a skin in the object. |
|
|
Sets the style property on the style declaration or object. |
The following table lists the methods the List class inherits from the UIComponent class. When calling these methods, use the form listInstance.methodName.
|
Method |
Description |
|---|---|
|
Returns a reference to the object that has focus. |
|
|
Sets focus to the component instance. |
The following table lists properties of the List class.
|
Property |
Description |
|---|---|
|
Assigns the class or symbol to use to display each row of the list. |
|
|
The source of the list items. |
|
|
The horizontal position of the list. |
|
|
Indicates whether the horizontal scroll bar is displayed ( |
|
|
A field in each item to be used to specify icons. |
|
|
A function that determines which icon to use. |
|
|
Specifies a field of each item to be used as label text. |
|
|
A function that determines which fields of each item to use for the label text. |
|
|
The number of items in the list. This property is read-only. |
|
|
The number of pixels the list can scroll to the right, when List.hScrollPolicy is set to |
|
|
Indicates whether multiple selection is allowed in the list ( |
|
|
The number of rows that are at least partially visible in the list. |
|
|
The pixel height of every row in the list. |
|
|
Indicates whether the list is selectable ( |
|
|
The index of a selection in a single-selection list. |
|
|
An array of the selected items in a multiple-selection list. |
|
|
The selected item in a single-selection list. This property is read-only. |
|
|
The selected item objects in a multiple-selection list. This property is read-only. |
|
|
The topmost visible item of the list. |
|
|
Indicates whether the vertical scroll bar is displayed ( |
The following table lists the properties the List class inherits from the UIObject class. When accessing these properties, use the form listInstance.propertyName.
|
Property |
Description |
|---|---|
|
The position of the bottom edge of the object, relative to the bottom edge of its parent. Read-only. |
|
|
The height of the object, in pixels. Read-only. |
|
|
The left edge of the object, in pixels. Read-only. |
|
|
The position of the right edge of the object, relative to the right edge of its parent. Read-only. |
|
|
A number indicating the scaling factor in the x direction of the object, relative to its parent. |
|
|
A number indicating the scaling factor in the y direction of the object, relative to its parent. |
|
|
The position of the top edge of the object, relative to its parent. Read-only. |
|
|
A Boolean value indicating whether the object is visible ( |
|
|
The width of the object, in pixels. Read-only. |
|
|
The left edge of the object, in pixels. Read-only. |
|
|
The top edge of the object, in pixels. Read-only. |
The following table lists the properties the List class inherits from the UIComponent class. When accessing these properties, use the form listInstance.propertyName.
|
Property |
Description |
|---|---|
|
Indicates whether the component can receive focus and input. |
|
|
A number indicating the tab order for a component in a document. |
The following table lists events that of the List class.
|
Event |
Description |
|---|---|
|
Broadcast whenever user interaction causes the selection to change. |
|
|
Broadcast when the pointer rolls over and then off of list items. |
|
|
Broadcast when the pointer rolls over list items. |
|
|
Broadcast when a list is scrolled. |
The following table lists the events the List class inherits from the UIObject class.
|
Event |
Description |
|---|---|
|
Broadcast when an object is about to draw its graphics. |
|
|
Broadcast when an object's state changes from visible to invisible. |
|
|
Broadcast when subobjects are being created. |
|
|
Broadcast when the object has moved. |
|
|
Broadcast when an object has been resized. |
|
|
Broadcast when an object's state changes from invisible to visible. |
|
|
Broadcast when the subobjects are being unloaded. |
The following table lists the events the List class inherits from the UIComponent class.
|
Event |
Description |
|---|---|
|
Broadcast when an object receives focus. |
|
|
Broadcast when an object loses focus. |
|
|
Broadcast when a key is pressed. |
|
|
Broadcast when a key is released. |
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00003703.html
Comments
mbd said on Oct 19, 2005 at 3:09 PM :