It doesn't happen automatically. You need to set this up, but it's not hard to
do. the thing about popups is that they act essentially like their own
application. so they don't normally pass events outside of the popup window.
events originate and terminate with the popup.
so for example, if you have
parent application
|
popup #1
|
popup #2
dispatch the event in popup #2 and listen for it in popup #1.
in popup #2 you would do a dispatchEvent(new Event("myCustomEventPopUp2"))
and in popup #1 in the same location that you generate/ create popup#2 you
would put an event listener on popup #2.
ie: popupObj.addEventListener("myCustomEventPopUp2","myPopUp2Function")
then in your function:
function myPopUp2Function(event) {
dispatchEvent(event)
}
Then in your parent app, you would put in the same kind of listener as you had
in the first popup:
ie: popupObj.addEventListener("myCustomEventPopUp2","myPopUp2Function")
It's a little round about, but it will get the job done. unfortunately, flex
doesn't handle this sort of event handling.
Hope that helps.
Jon Hirschi
----- Original Message ----
From: qnotemedia <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, March 20, 2007 1:21:29 PM
Subject: [flexcoders] Event Dispatching through more than one component
I'm still messing around with custom events.
If I have a popup embedded within another popup and want to dispatch an
event from the top-most component down to the parent application, do I
have to dispatch it to the first popup, and then redispatch the same
event to the parent app?
Is there any way to dispatch an event, but have it automatically go
through all components down to the root? Obviously I've tried, but
events seems to stop at the parent component, and they are not
automatically delivered to their parent's parent, etc.
What I'm thinking of doing instead is having each popup send a message
to the root to open other embedded popups, so that they are ALL created
from the root application rather than the popup. In essence, a custom
popup manager.
But I'm still curious if there's a way around the above scenario.
Thanks,
- Chris
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html