Lab Project

If you’ve been beating your head against the wall trying to get Cairngorm and Modules to work together, stop now. We’ve already knocked ourselves senseless, not that we had much sense to begin with, and, flux capacitor like, come up with a solution.

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 parent application utilizes the existing Cairngorm framework, while our modules leverage Cairngorm, supplemented by Modular.

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,, 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:

import com.arc90.modular.AbstractModuleEvent;
public class CairngormModuleEvent extends AbstractModuleEvent

Extend ModuleFrontController and add commands.

import com.arc90.modular.ModuleFrontController;
public class ModuleController extends ModuleFrontController
public function ModuleController()
addCommand("doSomethingAwesome", ModuleCommand);

Extend ModuleSequenceCommand for any commands that will be chained:

import com.arc90.modular.ModuleSequenceCommand;
public class ModuleCommand extends ModuleSequenceCommand

Dispatch events

Use the dispatch() method of the AbstractModuleEvent class to dispatch your events.

var event:CairngormModuleEvent = new CairngormModuleEvent("doSomethingAwesome");

or, use the CairngormEventDispatcherFactory.

CairngormEventDispatcherFactory.getDispatcher(this).dispatchEvent(new CairngormModuleEvent("doSomethingAwesome"));


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.