Tools
Modular
What is this?
There's been a lot of talk about using Cairngorm with Flex's built in Module framework, and the general consensus is that it's just not worth the effort. Here at Arc90, we use Cairngorm extensively, and until recently, had not leveraged modules. Then we found ourselves faced with the dilemma of making Cairngorm and Modules play nice. It turns out that the solution was fairly simple, as well as lightweight: we call it Modular.
Modular makes use of some great ideas that have been floating around the Flex community for awhile:
- The ChainEvent package developed by Bjorn Schultheiss for sequencing commands.
- The CairngormEventDispatcherFactory concept by vic on flex.
How Do I Use It?
To use Modular in your Flex projects, just follow these simple steps:
Download The Code
Click on the icon below to download the source code:
The file, modular.zip, contains a compiled library, the source, and ASDoc generated documentation.
Add the code to your Flex project
You can either add the compiled library, Modular.swc, to your project's library path, or include the source directly in your project.
Build your application by extending the classes contained in the com.arc90.modular package.
Any events that will be broadcast by the CairngormEventDispatcher should be instances of AbstractModuleEvent or a subclass:
Extend ModuleFrontController and add commands.
Extend ModuleSequenceCommand for any commands that will be chained:
Dispatch events
Use the dispatch() method of the AbstractModuleEvent class to dispatch your events.
or, use the CairngormEventDispatcherFactory.
Licensing
This arc90 tool is licensed under the Creative Commons Attribution 2.5 license.
Discuss Modular
You can offer feedback on Modular at the arc90 blog.