My team is currently in the process of developing a large modular Flex
application that is based on Cairngorm and uses the mx:Modules.

We put the Cairngorm framework and all 'core' classes (ie Controller,
ModelLocator, ValueObject, centralized Commands) into a Flex Library.
Each module was setup as a separate Flex project along with a shell
project that was responsible for loading the modules and creating the
basic shell application. Each of the modules accessed the 'core'
classes as an RSL during development and then the option was set to
'external' for deployment to reduce file size and duplication. The
shell used the 'include' compiler option to compile the entire 'core'
library into the shell so that all classes where available for the
modules. Each module ran a method upon loading that would register any
module specific Commands with the FrontController and register for any
events, etc.

The one thing that was quite tricky was uncoupling binding from the
ModelLocator during module unloads. Using the {} method in the
property attribute of a control (ie <mx:DataGrid
dataProvider="{model.shoppingList}"/>) does not allow you to uncouple
the binding at a later time, which prevents garbage collection.
Instead we had to use the BindingUtils and then call a method just
before unloading a module to remove the bindings, then the module
could be properly unloaded and garbage collected. Also we had to make
sure we used weak reference event listeners in order to ensure garbage
collection would properly occur on the unloaded modules.

Hope that information helps you out.

Derrick
-------------
Derrick Grigg
[EMAIL PROTECTED]

Reply via email to