I have a s:List component. I want to handle a click event to know what list item is selected. I don't see Click event in s:List. Any workarounds?
Thanks.
I have a s:List component. I want to handle a click event to know what list item is selected. I don't see Click event in s:List. Any workarounds?
Thanks.
I figured how to do this. Thought I would share so that it helps others like me:
<s:List id="taskList" creationComplete="taskList.addEventListener('listClickEvent',handleListClick);" width="100%" height="80%" labelField="description" dataProvider="{todoList}"
useHandCursor="true">
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer click="handleClick(event)">
<fx:Script>
<![CDATA[
import ListClickEvent;
import flash.events.MouseEvent;
import mx.controls.Alert;
private function handleClick(me:MouseEvent):void
{
var listClickEvent:ListClickEvent = new ListClickEvent("listClickEvent");
listClickEvent.index = itemIndex;
owner.dispatchEvent(listClickEvent);
}
]]>
</fx:Script>
<s:Label text="{data.description}" top="5" bottom="5" right="3" left="3"/>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>