itemClick is an event, not a property or style.  you want to write
something like this:
 
 
myTileList.addEventListener(ListEvent.ITEM_CLICK, doItemClick);
 
 
public function doItemClick(event:ListEvent):void {
    Alert.show(event.currentTarget.selectedIndex.toString());
}
 
 
Note that when you pass a function handler you only use the function
name, including the () operator will run the function and then pass the
result.  The reason you were getting the alert is because your code was
executing the function everytime it came to that setStyle call.
 

-- 
Ronald Kinion 
Phone: 253-205-3494 
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  
www.zones.com <http://www.zones.com/>  

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jayson
Sent: Friday, September 07, 2007 10:20 AM
To: [email protected]
Subject: [flexcoders] TileList controls in AS



Maybe I'm just blind, but I cant seem to find an itemClick property for 
a TileList in AS.

myTileList.itemClick doesnt appear to be there.. so.. I tried this..

myTileList.setStyle ("itemClick", doItemClick());

public function doItemClick():void{
Alert.show(myTileList.selectedIndex.toString());
}

Something is triggering this.. upon creation of the TL I get the alert 
with -1, obviously meaning nothing is selected, but then nothing 
happens when I click on an item. I've been searching for a while and 
haven't made any progress at all.. anyone know whats going on?

Thanks,

Jayson



 

Reply via email to