apache-flexactionscript-3tilelist

how to identify a selected object in tilelist?


I have tilelist, which is dynamically loaded XML file with pictures, How do I do that would be when you click on a picture in the Label gave her name?

 <mx:TileList id="tileList"
             alternatingItemColors="[#FFFFFF,#EEEEEE]"
             dataProvider="{xmlListColl}"
             itemRenderer="TileListItemRenderer"
             columnCount="3"
             columnWidth="100"
             rowCount="2"
             rowHeight="100"
             direction="horizontal"
             verticalScrollPolicy="on"/>

Solution

  • in your TileList call a function with

    itemClick="somthingSelected();"
    
    public function somthingSelected():void{
      trace( this.tileList.selectedItem.@id )
    }
    

    "id" is the attribute in your xml dataprovider or whatever you want it to be