Event-based interaction between two custom classes
Posted
by Antenka
on Stack Overflow
See other posts from Stack Overflow
or by Antenka
Published on 2010-05-25T13:36:47Z
Indexed on
2010/05/25
13:41 UTC
Read the original article
Hit count: 156
Hello everybody. I have such problem: I have 2 custom components, which have their own nesting hierarchy ... One is container for another. I have to "familiarize them" with each other. The way I'm trying to achieve that is using global events (one side is firing and the other one is catching):
Application.application.addEventListener("Hello", function (data:Event):void{
// .. some actions
});
//and
Application.application.dispatchEvent(new Event(Hello));
Everything is pretty good, but there's one thingy .. when I'm trying to catch the event, I can't access the class, who is catching it. E.g.:
- Container fires the event.
- Child caughts it.
- Then should be created the connection between container and it's child.
BUT, the only thing I could acheive is passing a reference to the Container in the DynamicEvent. Is there any chance that I could access the child at the event-handler function. Or maybe there's more elegant way to solve this problem ...
Any help would be greately appreciated :)
© Stack Overflow or respective owner