flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prabhu Moorthy <Prabu.Moor...@symphonysummit.com>
Subject RE: Bubbling to a Grandparent
Date Tue, 09 Dec 2014 04:36:00 GMT
You can remove the change event listener from A.mxml file. Listen the event
in Grandparent Example.mxml file as
/asDG.aAs.addEventListener(ChangeA.CHANGED, asDG_aChangedHandler);/

But in A.mxml file dispatch the same event when datagrid change. Once again
you need to add event listener in Grandparent Example.mxml file as
/asDG.addEventListener(ChangeA.CHANGED, asDG_aChangedHandler);/

Better don't dispatch event from As.as. Use As.as as Data model add or
update the data. Dispatch all events from A.mxml. So one event listener is
enough in Grandparent Example.mxml file as
/asDG.addEventListener(ChangeA.CHANGED, asDG_aChangedHandler);/

Change below method in A.mxml file as
protected function aUpdateBtn_clickHandler(event:MouseEvent):void
      if (asDG.selectedIndex > -1)
             dispacthChangeEvent(aAs.getID());//get id from As.as

protected function asDG_changeHandler(event:ListEvent):void

private function dispacthChangeEvent(id:int):void
     dispatchEvent(new ChangeA("aChanged", id));

Thanks & Regards,
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Bubbling-to-a-Grandparent-tp8997p9025.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

View raw message