|
-
Pumpkin Carving 2008
AS3|AIR Understanding Event Propogation. Totally confused.
Here's the layout of my classes (as DisplayObjects on the Stage, it follows the same structure):
The FLA
Document Class
The idea here is that I can have several Clients on the screen, and only one Database. When, for instance, the Database processes a login request, I believe there is no way for the Client to hear that event fire off as they're at the same depth in the DisplayObject hierarchy (correct me on this if I'm wrong; it's my first question).
Secondly, from within the Client class I cannot seem to add an event listener to it that can hear the events fire from the Login Form class. Instead the Client has to add them to the Document's stage (aka the FLA stage), which in turn calls a function within the Client. I do not believe this to be good coding habits (ugly scope issues) and I don't believe this is right. I was under the impression that event propogation (with Bubbles = true) rode up the hierarchy to the Stage. Can someone elaborate on this? The "eventphase" doesn't really help me here, and I'd like if possible to be able to see the event go up the hierarchy (as I understand it, it also goes back down, too. Is this right?)
To summarize:
- Can two display objects at the same depth in the DisplayObject hierarchy hear each others events?
- Can't a DisplayObject hear the events fired from its' children?
- Does event propogation 'phases' mean the event goes up and then back down the hierarchy?
Thanks to anyone who cares to help me out. 
*EDIT* It might also be important to note that the Client is actually extending NativeWindow, which I believe may be where some of my problems lie. In a worst-case scenario, if need be, I can make a central Event-handling class, but I was trying to avoid looping through the list of clients every time an event is dispatched. In this situation, I am also closing the 'root' Stage, and creating new NativeWindow (Clients) from a SystemTray object within the Document Class.
Last edited by ImprisonedPride; 03-15-2012 at 12:03 PM.
Reason: Clearing up stuff.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|