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 |
A new TileListData component is created for a cell renderer each time it is invalidated.
Related API Elements
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 | ||
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 |
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 | ||
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 |
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
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.
Parameterslabel: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
To run the example, follow these steps:
- Add the TileList component to the library.
- Save this code as TileListDataExample.as in the same directory as your FLA file.
- Set the Document class in the FLA file to 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); } }
Mon Nov 28 2011, 06:48 AM -08:00