I have posted a short article about a convenient way to handle dispatchEvent() in large applications: http://blueskyflash.blogspot.com. It's about how to simply and quickly communicate between distant components. I would appreciate if some of you could read it and give some feedback? Thanks.
Comments
Looks good, almost exactly the same way cairngorm deals with it's events with a singleton eventdispatcher. Good job.
The only thing to watch with this is that if you have many programmers working on the same app they may have a listener somewhere else in the application and they may not be aware of the possible sideeffects by throwing an event.
This looks just like observeValue pattern. Not only the sideeffects it's hard to maintain all events and where the handlers are.
This will work fine in a small app. But, I would not recommend this for large apps. I think the issue is the fact that you are trying to dispatch events between not closely related components. As long as you avoid this situation then you don't have to use this specially in MVC pattern.
jon, babo, thanks for your replies. I was aware of that problem and the simplest solution was to track every event in EventCentral.mxml in a comment section, with the info 'sent by' and 'received by'. That worked well.