popup – Flex 3: How do I reference the Modal Button in a Custom Component? – Education Career Blog

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

,

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.

Leave a Comment