简体   繁体   中英

Flex 3: How do I reference the Modal Button in a Custom Component?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM