fl.controls.listClasses
public class TileListData
继承TileListData Inheritance ListData Inheritance Object

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

TileListData 是一种信使类,该类将与特定单元格相关的信息保存在基于列表的 TileListData 组件中。 该信息包括与单元格关联的标签和图像源(无论是否选择了单元格),以及单元格在列表中的位置(通过行和列来表示)。

每当 TileListData 组件变为无效时,都会为单元格渲染器创建一个新的 TileListData 组件。

查看示例

另请参见

ListData



公共 属性
 属性定义方
 Inheritedcolumn : uint
[read-only] 数据项目所在的列。
ListData
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
 Inheritedicon : Object
[read-only] 一个表示 List 组件中项目的图标的类,根据 List 类方法计算得出。
ListData
 Inheritedindex : uint
[read-only] 数据提供者中项目的索引。
ListData
 Inheritedlabel : String
[read-only] 要在单元格中显示的标签。
ListData
 Inheritedowner : UIComponent
[read-only] 对拥有此项目的 List 对象的引用。
ListData
 Inheritedprototype : Object
[static] 对类或函数对象的原型对象的引用。
Object
 Inheritedrow : 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
 Inherited
指示对象是否已经定义了指定的属性。
Object
 Inherited
指示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
指示指定的属性是否存在、是否可枚举。
Object
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
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。

另请参见

示例 如何使用示例

此示例演示如何访问平铺列表中图像单元格的 TileListData 对象。

若要运行该示例,请按照下列步骤操作:

  1. 将 TileList 组件添加到库中。
  2. 将该代码作为 TileListDataExample.as 另存到 FLA 文件所在的同一目录中。
  3. 将 FLA 文件中的 Document 类设置为 TileListDataExample。
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