In Actionscript 3 is there any way to determine the precise display object hierarchy an event will traverse through when dispatched from a given object? The object is not necessarily a display object.
Although I could imagine this actually being useful somehow, in my particular case it is a learning exercise. I’m trying to master the event system in flash and have some locations where I’m very curious what path an event will take when I dispatch it.
The answer is sort of. Events aren’t limited to DisplayObjects, and when they are triggered by DisplayObjects, they don’t always follow the same pattern — the Event may very based on what type of DisplayObject and whether the event was triggered programmatically (through dispatchEvent) or natively (by a mouseClick). It may also vary based on whether bubbling is enabled or not and if it is a custom event. A Loader’s complete event, for example, does not make sense to propagate to parent objects, even though Loader is a display object.
If you’re trying to figure out the parents of the object which dispatched an event, then you’ll want something like this: