fl.controls.listClasses

# TileListData - AS3 Flash

Package | fl.controls.listClasses
Class | public class TileListData
Inheritance | TileListData ListData Object

Language Version: | ActionScript 3.0

Product Version: | Flash CS3

Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0

TileListData is a messenger class that holds information relevant to a specific cell in the list-based TileListData component. This information includes the label and image source that are associated with the cell; whether or not the cell is selected; and the position of the cell in the list by row and column.

A new TileListData component is created for a cell renderer each time it is invalidated.

View the examples

Related API Elements

ListData

Public Properties
Hide Inherited Public Properties
Show Inherited 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
|  | row : uint [read-only] The row in which the data item is displayed. | ListData
|  | source : Object [read-only] Gets or sets an absolute or relative URL that identifies the location of the SWF or image file to load, the class name of a movie clip in the library, or a reference to a display object. | TileListData

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | TileListData(label:String, icon:Object, source:Object, owner:UIComponent, index:uint, row:uint, col:uint = 0) Creates a new instance of the TileListData class as specified by its parameters. | TileListData
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### source

property

`source:Object` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flash CS3

Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0

Gets or sets an absolute or relative URL that identifies the location of the SWF or image file to load, the class name of a movie clip in the library, or a reference to a display object. The TileListData does not load the source, it only passes the value of the source on to the ImageCell.

Valid image file formats include GIF, PNG, and JPEG.

The default value is `null.`

Implementation
`public function get source():Object`
Constructor Detail

### TileListData

()
Constructor

`public function TileListData(label:String, icon:Object, source: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 TileListData class as specified by its parameters. The TileListData class inherits the properties of the ListData class, and adds a source parameter for the path to the image that is associated with the cell.

Parameters

| `label:String` — The label to be displayed in this cell.
| `icon:Object` — The icon to be displayed in this cell.
| `source:Object` — The path or class that is associated with the content to be displayed in the 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 corresponds to the index. In a TileList it may be different than the index.
| `col:uint` (default = `0`)`` — The column in which this item is being displayed. In a List this will always be equal to 0.

Related API Elements

ListData
Examples How to use this example
TileListDataExample.as
This example illustrates how to access the TileListData object of an image cell in a tile list.

To run the example, follow these steps:

1. Add the TileList component to the library.
2. Save this code as TileListDataExample.as in the same directory as your FLA file.
3. Set the Document class in the FLA file to TileListDataExample.

Copy

    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);
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00