| 包 | fl.controls.listClasses |
| 类 | public class TileListData |
| 继承 | TileListData ListData Object |
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
每当 TileListData 组件变为无效时,都会为单元格渲染器创建一个新的 TileListData 组件。
另请参见
| 属性 | 定义方 | ||
|---|---|---|---|
![]() | 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 | |
| source : Object
[read-only]
获取或设置一个绝对或相对 URL(该 URL 标识要加载的 SWF 或图像文件的位置)、库中影片剪辑的类名称或者对显示对象的引用。
| TileListData | ||
| 方法 | 定义方 | ||
|---|---|---|---|
|
TileListData(label:String, icon:Object, source:Object, owner:UIComponent, index:uint, row:uint, col:uint = 0)
按照参数的指定创建 TileListData 类的新实例。
| TileListData | ||
![]() |
指示对象是否已经定义了指定的属性。
| Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。
| Object | |
![]() |
指示指定的属性是否存在、是否可枚举。
| Object | |
![]() |
设置循环操作动态属性的可用性。
| Object | |
![]() |
返回指定对象的字符串表示形式。
| Object | |
![]() |
返回指定对象的原始值。
| Object | |
| source | 属性 |
source:Object [read-only]
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
获取或设置一个绝对或相对 URL(该 URL 标识要加载的 SWF 或图像文件的位置)、库中影片剪辑的类名称或者对显示对象的引用。 TileListData 不加载源文件,只将源文件的值传递给 ImageCell。
有效的图像文件格式包括 GIF、PNG 和 JPEG。
默认值为 null.
public function get source():Object
| TileListData | () | 构造函数 |
public function TileListData(label:String, icon:Object, source:Object, owner:UIComponent, index:uint, row:uint, col:uint = 0)
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
按照参数的指定创建 TileListData 类的新实例。 TileListData 类继承 ListData 类的属性,并将路径的 source 参数添加到与单元格关联的图像。
参数label:String — 要在此单元格中显示的标签。
|
|
icon:Object — 要在此单元格中显示的图标。
|
|
source:Object — 与要在单元格中显示的内容关联的路径或类。
|
|
owner:UIComponent — 拥有此单元格的组件。
|
|
index:uint — 数据提供者中项目的索引。
|
|
row:uint — 此项目所在的行。 在 List 或 DataGrid 中,这对应于索引。 在 TileList 中,可能与索引不同。
|
|
col:uint (default = 0) — 此项目所在的列。 在 List 中始终为 0。
|
另请参见
若要运行该示例,请按照下列步骤操作:
package
{
import fl.controls.TileList;
import fl.controls.listClasses.ImageCell;
import fl.controls.listClasses.TileListData;
import fl.data.DataProvider;
import fl.events.ListEvent;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class TileListDataExample extends Sprite
{
var sourceClasses:Array = [ RedBox, GreenBox, BlueBox ];
var myTileList:TileList;
var tf:TextField;
public function TileListDataExample() {
createList();
tf = new TextField();
tf.x = 10;
tf.y = 10;
tf.autoSize = TextFieldAutoSize.LEFT;
addChild(tf);
}
private function createList():void {
myTileList = new TileList();
myTileList.move(10,40);
myTileList.addEventListener(ListEvent.ITEM_CLICK,itemSelected);
var dp:DataProvider = new DataProvider();
var i:uint;
for(i=0; i<42; i++) {
dp.addItem( { label:"Item " + i, source:getRandomImageCellSource() } );
}
myTileList.dataProvider = dp;
myTileList.rowCount = 3;
myTileList.columnCount = 7;
addChild(myTileList);
}
private function itemSelected(e:ListEvent):void {
var renderer:ImageCell = myTileList.itemToCellRenderer(e.item) as ImageCell;
var listData:TileListData = renderer.listData as TileListData;
tf.text = "You have clicked an item that uses " + listData.source + " for a source.";
}
private function getRandomImageCellSource():Class {
return sourceClasses[Math.floor(Math.random()*sourceClasses.length)];
}
}
}
import flash.display.Sprite;
class RedBox extends Sprite {
public function RedBox() {
graphics.beginFill(0x990000);
graphics.drawRect(0,0,100,100);
}
}
class GreenBox extends Sprite {
public function GreenBox() {
graphics.beginFill(0x009900);
graphics.drawRect(0,0,100,100);
}
}
class BlueBox extends Sprite {
public function BlueBox() {
graphics.beginFill(0x000099);
graphics.drawRect(0,0,100,100);
}
}
当前页: http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/fl/controls/listClasses/TileListData.html