You'd be better listening to some property in your model and update that 
property when tabs are changing. Your approach doesn't convince me.

But then, maybe I didn't get it right...
C




________________________________
From: edencane <lukevanderfl...@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Wednesday, September 16, 2009 11:07:05 AM
Subject: Re: [flexcoders] child component listens for event on parent

   

I was able to get the event happening by changing the component code to be:

private function postInit():void {
Application. application. addEventListener ("buttonLabelEve nt",
buttonLabelHandler) ;
}

but now the event seems to trigger 3 times for every tab change but doesnt
trigger on the first tab change...

And the app takes forever to compile as well...

Something still not right..

Please help..

edencane wrote:
> 
> Hi.
> 
> Im trying to get a child component to listen for an event that happens on
> tabchange in the parent.
> The parent is an application with a TabNavigator object.
> When the tabchanges I want the the child component to carry out some
> stuff.
> 
> In the parent Ive got:
>       <mx:Metadata>
>               [Event(name= "buttonLabelEven t", type=" flash.events. Event")]
>       </mx:Metadata>
> 
> then in the tabChange function Ive got:
>         var bLEvent:Event = new Event("buttonLabelE vent");
>        dispatchEvent( bLEvent);
> 
> Now I want to listen for this event in a child component.
> There are several instances of the childcomponent (which is basically a
> form containing a combobox) in the main application.
> I want every instance of the childcomponent to listen and act when a
> tabchange occurs in the main component.
> 
> So far in the component I have:
> creationComplete= "postInit( )"
> Then in postInit I have:
> this.addEventListen er(Application. application. buttonLabelEvent ,
> buttonLabelHandler) ;
> 
> However, this is not right.
> 
> how do I do this...?
> 
> Thanks for help...
> Kind regards.
> Luke Vanderfluit.
> 
> 

-- 
View this message in context: http://www.nabble. com/child- component- 
listens-for- event-on- parent-tp2546673 4p25467780. html
Sent from the FlexCoders mailing list archive at Nabble.com.


   


      

Reply via email to