Hi,
I am making a custom mxml component, composed of a datagrid and a few
buttons.
I am potentially dispatching the following 2 events:
[Event(name="btnClick", type="flash.events.MouseEvent")]
[Event(name="rowClick", type="mx.events.ListEvent")]
These events are thrown by event handlers on the actual individual
component (either a button or a grid).
for the grid:
private function dispatchRowClickEvent(ev:ListEvent):void{
var e:ListEvent=new ListEvent('rowClick');
e.rowIndex=ev.rowIndex;
dispatchEvent(e);
}
for the button
<mx:Button id="btnRefreshRecord"
icon="@Embed(source='../assets/icons/table_refresh.png')" width="20"
height="20" click="dispatchEvent(new Event('gridRefresh'))"
toolTip="Refresh table content" />
My problem is when I consume these events from the component, I'd like
to be able to write something like:
public function dgDoubleClickHandler(event:ListEvent) : void
{
var currentIssueForm:IssueForm = new IssueForm();
var buf:XML = XML(event.currentTarget.selectedItem);
currentIssueForm.modelIssue = buf;
PopUpManager.addPopUp(currentIssueForm, this, true);
PopUpManager.centerPopUp(currentIssueForm);
}
However at runtime it fails because event.currentTarget.selectedItem
is null.
It is null because the event I am catching is the custom component
event and not the low-level datagrid event....
Is there a way to wrap the datagrid event [and keep its content]
whilst still renaming it ?
Or maybe there is just a simpler way to do this ?
Thanks,
Romain.