| 包 | fl.controls.listClasses |
| 类 | public class ListData |
| 继承 | ListData Object |
| 子类 | TileListData |
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
每当 ListData 组件变为无效时,都会为单元格渲染器创建一个新的 ListData 组件。
| 属性 | 定义方 | ||
|---|---|---|---|
| column : uint
[read-only]
数据项目所在的列。
| ListData | ||
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。
| Object | |
| icon : Object
[read-only]
一个表示 List 组件中项目的图标的类,根据 List 类方法计算得出。
| ListData | ||
| index : uint
[read-only]
数据提供者中项目的索引。
| ListData | ||
| label : String
[read-only]
要在单元格中显示的标签。
| ListData | ||
| owner : UIComponent
[read-only]
对拥有此项目的 List 对象的引用。
| ListData | ||
![]() | prototype : Object
[static]
对类或函数对象的原型对象的引用。
| Object | |
| row : uint
[read-only]
数据项目所在的行。
| ListData | ||
| 方法 | 定义方 | ||
|---|---|---|---|
|
按照参数的指定创建 ListData 类的新实例。
| ListData | ||
![]() |
指示对象是否已经定义了指定的属性。
| Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。
| Object | |
![]() |
指示指定的属性是否存在、是否可枚举。
| Object | |
![]() |
设置循环操作动态属性的可用性。
| Object | |
![]() |
返回指定对象的字符串表示形式。
| Object | |
![]() |
返回指定对象的原始值。
| Object | |
| column | 属性 |
column:uint [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
数据项目所在的列。 在 List 中,该值始终为 0。
public function get column():uint
| icon | 属性 |
icon:Object [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
一个表示 List 组件中项目的图标的类,根据 List 类方法计算得出。
public function get icon():Object
| index | 属性 |
index:uint [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
数据提供者中项目的索引。
public function get index():uint
| label | 属性 |
label:String [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
要在单元格中显示的标签。
public function get label():String
| owner | 属性 |
owner:UIComponent [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
对拥有此项目的 List 对象的引用。
public function get owner():UIComponent
| row | 属性 |
row:uint [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
数据项目所在的行。
public function get row():uint
| ListData | () | 构造函数 |
public function ListData(label:String, icon:Object, owner:UIComponent, index:uint, row:uint, col:uint = 0)
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
按照参数的指定创建 ListData 类的新实例。
参数label:String — 要在此单元格中显示的标签。
|
|
icon:Object — 要在此单元格中显示的图标。
|
|
owner:UIComponent — 拥有此单元格的组件。
|
|
index:uint — 数据提供者中项目的索引。
|
|
row:uint — 此项目所在的行。 在 List 或 DataGrid 中,该值对应于索引。 在 TileList 中,该值可能与索引不同。
|
|
col:uint (default = 0) — 此项目所在的列。 在 List 中,该值始终为 0。
|
listData 属性。
若要运行该示例,请按照下列步骤操作:
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;
}
}
}
当前页: http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/fl/controls/listClasses/ListData.html