(Beta)
Package | fl.controls.listClasses |
Class | public class TileListData |
Inheritance | TileListData ![]() ![]() |
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
Public Properties
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object |
Public Methods
Method | Defined By | ||
---|---|---|---|
![]() |
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 |
Property Detail
Constructor Detail
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:
- 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); } }
Wed Nov 21 2018, 06:34 AM -08:00