I have a DataGrid and the first column cells have an itemRenderer with an embebed image and doubleClick event linked.
So, when o double click event occur, this renderer catch the event and the handler. The question is that I would like to dispatch an Event with the index of the selected item in the Datagrid and I do not find out how to ge it.
s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" clipAndEnableScrolling="true"
width="50" height="30">
<fx:Script>
<![CDATA[
import events.EditItemEvent;
import mx.controls.Alert;
override public function prepare(hasBeenRecycled:Boolean):void {}
protected function btn_edit_doubleClickHandler(event:MouseEvent):void {
/* here I dispatchEvent with the 'index' of the selectedItem of the datagrid */
}
]]>
</fx:Script>
<s:Image id="btn_edit" horizontalCenter="0" source="@Embed('assets/images/edit_icon.png')"
verticalCenter="0"
doubleClickEnabled="true"
doubleClick="btn_edit_doubleClickHandler(event)"/>
Any idea?