I switched to Mate framework for Flex a few months ago and really love its simplicity in respect to Cairngorm and other frameworks. Mate is a tag-based, event-driven Flex framework that provides a mechanism for dependency injection to make it easy for the different parts of an application to get the data and objects they need. If you know Spring then you'll love Mate.
In this project I'm using BlazeDS for remoting and messaging with Salesforce.com and SQL Server 2005.
With Mate, you typically have a view (ie Login.mxml) that dispatches an event (ie LoginEvent.DO_LOGIN) and an EventMap that listens for the event and performs some action (eg log into Salesforce.com). My problem was that I was using an inline itemrenderer in my view which was making it extremely difficult to process and dispatch the event. My proposed solution was to dispatch a simple event and have the EventMap invoke a method on my Manager:
The Manager method would then process the login request based upon some business logic and then dispatch appropriate event:
Unfortunately this approach does not work as events dispatched from non-views will not make it to the event map. I found a very detailed post of the process and a proposed work around. There was also another post with some more information that helped me successfully dispatch my event from the Manager class.
Here is the event handler in the map injecting the event map's dispatcher into the Manager:
In the Manager class we need to add a public property for the dispatcher reference:
Now modify the method to dispatch events using the reference to the dispatcher public property (ie dispatcher.dispatchEvent(evt)):
Now you can successfully dispatch an event from a Manager class and have it picked up from in the EventMap.