Package | fl.controls.listClasses |
Class | public class ListData |
Inheritance | ListData Object |
Subclasses | TileListData |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
A new ListData component is created for a cell renderer each time it is invalidated.
Public Properties
Property | Defined By | ||
---|---|---|---|
column : uint [read-only]
The column in which the data item is displayed. | ListData | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
icon : Object [read-only]
A class that represents the icon for the item in the List component,
computed from the List class method. | ListData | ||
index : uint [read-only]
The index of the item in the data provider. | ListData | ||
label : String [read-only]
The label to be displayed in the cell. | ListData | ||
owner : UIComponent [read-only]
A reference to the List object that owns this item. | ListData | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
row : uint [read-only]
The row in which the data item is displayed. | ListData |
Public Methods
Method | Defined By | ||
---|---|---|---|
Creates a new instance of the ListData class as specified by its parameters. | ListData | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
Property Detail
column | property |
icon | property |
index | property |
label | property |
owner | property |
owner:UIComponent
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
A reference to the List object that owns this item.
Implementation
public function get owner():UIComponent
row | property |
Constructor Detail
ListData | () | Constructor |
public function ListData(label:String, icon:Object, owner:UIComponent, index:uint, row:uint, col:uint = 0)
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new instance of the ListData class as specified by its parameters.
Parameterslabel:String — The label to be displayed in this cell.
| |
icon:Object — The icon to be displayed in this cell.
| |
owner:UIComponent — The component that owns this cell.
| |
index:uint — The index of the item in the data provider.
| |
row:uint — The row in which this item is being displayed. In a List or
DataGrid, this value corresponds to the index. In a TileList, this
value may be different than the index.
| |
col:uint (default = 0 ) — The column in which this item is being displayed. In a List,
this value is always 0.
|
Examples How to use this example
ListDataExample.as
This example illustrates how to access the
listData
property of a cell renderer.
To run the example, follow these steps:
- Add the List and Button components to the library.
- Save this code as ListDataExample.as in the same directory as your FLA file.
- Set the Document class in the FLA file to ListDataExample.
package { import fl.controls.List; import fl.controls.listClasses.CellRenderer; import fl.controls.listClasses.ListData; import fl.events.ListEvent; import flash.display.Sprite; import flash.events.Event; import flash.text.TextField; public class ListDataExample extends Sprite { var sampleItem1:Object = { label:"John Alpha" }; var sampleItem2:Object = { label:"Mary Bravo" }; var sampleItem3:Object = { label:"Trevor Gamma" }; var sampleItem4:Object = { label:"Susan Delta" }; var myList:List; var tf:TextField; public function ListDataExample() { createList(); tf = new TextField(); tf.x = 10; tf.y = 125; addChild(tf); } private function createList():void { myList = new List(); myList.move(10,10); myList.addItem(sampleItem1); myList.addItem(sampleItem2); myList.addItem(sampleItem3); myList.addItem(sampleItem4); myList.rowCount = 4; myList.addEventListener(ListEvent.ITEM_CLICK,listItemSelected); addChild(myList); } private function listItemSelected(e:ListEvent):void { var cr:CellRenderer = myList.itemToCellRenderer(e.item) as CellRenderer; var listData:ListData = cr.listData; tf.text = "Row selected: " + listData.row; } } }
Mon Nov 28 2011, 06:48 AM -08:00