PDA

View Full Version : fl.controls.List



bgflasher
March 19th, 2009, 07:32 AM
Hello.
I have a question about List component.
I want to ask if there is a possibility to select a List's item (make it selectedItem) without a Click event? I want to make the item selected on a different type of event event.
I checked Adobe's documentation about fl.controls.List but i could find only scrollToIndex() method which scrolls the list to a specified index. That's OK but i don't want only to scroll to this index but to select its list Item.

zanemx
March 19th, 2009, 10:00 AM
How do you want to trigger the selected item? I usually use the ListEvent class.




myList.addEventListener(ListEvent.ROLL_OVER, ITEM_OVER);

function ITEM_OVER(e:ListEvent):void{
//do some bad *** stuff
}

bgflasher
March 19th, 2009, 02:23 PM
Thank you for your answer.
I figured it out:
I used scrollToIndex() function first to scroll the list to the item I want. After that I use selectedIndex property and all done :)