Here's the layout of my classes (as DisplayObjects on the Stage, it follows the same structure):
The FLA
Document ClassDatabase :: SpriteClient :: SpriteLogin Form :: Sprite
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.
