tags:

views:

9

answers:

1

Hi,

I've got a custom component based on a TitleWindow. I want to put an event listener in my main app that listens for the Titlewindow's modal button's click

Custom Component:

<mx:TitleWindow 
  showCloseButton="true" 
  close="closeHandler(event)">

blah blah...

<mx:TitleWindow>

In the main app:

I've got a variable called popWindow, which is the above component. How do I reference the TitleWindow's modal button?

I want to do something like this:

(Pseudo-code) popWindow.[modal button reference].addEventListener(MouseEvent.CLICK, myFunction);

Thank you.

-Laxmidi

+1  A: 

Have you tried adding the event listener to popWindow directly? That MouseEvent should bubble; you will have to check the target on it though to make sure it is the click you are looking for.

Edit: you could also dispatch out a new event in your close handler and listen for that event on this outside, by just adding an event dispatcher on your popWindow as well.

Ryan Guill
Hi Ryan, Thanks for the help. As you suggested, I put a listener on popWindow directly. I found the closeEvent. popWindow.addEventListener(CloseEvent.CLOSE, turnOffButton2);
Laxmidi