I am following a presentation model pattern for a component I am creating.
I have a view which houses all my mxml then an actionscript class that houses the logic. I then have another view that contains this custom component. The actionscript class is dispatching an event with the bubbles argument true. I want to catch the event in the containing main view but it is not able to see the event and there is nothing cancelling the event propogation.
The object hierarchy looks like this:
actionscript class (dispatches event)
custom component view
main view (should catch the event)
I've attached an event listener to the custom compoenent and it is not catching the event. If I make the actionscript class public and add the event listener to that class specifically it does get called.
My problem is that I don't want the actionscript class to be public, can anyone explain why making the event bubble still doesn't allow the main view to listen to it?
Bubbling only works for DisplayObjects that are in a tree.
So, just to make sure I understand this.
Because the actionscript class is not a display object the event doesn't bubble? If I had a sub-component to the mxml class and it was a mxml display object would the event bubble?
Catch the event in the first view, and redispatch it with bubbling set to true.