Flex Modules Using PureMVC Multicore and Pipes

Written by

I found this post unfinished in my drafts folder and I have no time to go into detail explaining the script as I previously would have liked, however, I have released the source and listed below are all the relevent aspects of the ANT build and classes. Looking at the source quickly to refresh my mind there are some useful elements there for (a) compiling modules, swf’s and swcs using ANT (b) module loading in PMVC using an external xml file (c) compiling and using all library resources into one library swc (whether good or bad).

At the tail end of 2009 I built an script for ANT which compiled a flex modular project and I wanted to build a demo around this script. Due to lack of time it’s taken a lot longer than I had hoped to wrap this up and to be honest I am sure there are areas that could be further refined. Essentially my main goals are achieved with this example, one of which being all the module swf’s are external projects in relation to the main application project.

Once again to save time I have not totally re-invented the wheel and have basically expanded Joel Hooks excellent application he uses in his blog post on the same topic, thanks for your approval for this Joel.

There are a few points I wanted to achieve for this demo: + Utilise Runtime Shared Libraries. + Ensure all modules are compiled efficiently i.e. not re-loading in any libraries the shell swf will have already baked in. + Successfully compile using ANT. + Have all the modules external to the main application project i.e. separate projects. + Define a config.xml file for external modules, loading and defining various attributes for all modules. + I have noticed in other examples that the module loading logic is duplicated, specifying module names, etc with further accumulation of classes. I wanted to have one route of loading modules regardless of type and generically load modules into the shell. + Try to reduce the total amount of code as much as possible due to Multicore/Pipes applications accumilating a lot of code very easily. + Only rely on the bare essentials for the project as a whole for constructing a modular application i.e. simply PureMVC Multicore and it’s approved small utilities for example, Pipes and StateMachine. + Build some simple utility style classes for re-use across modules. + Combine libraries used across all modules i.e. PureMVC into one library swc and build the swc using ANT.

Here is all the source and ANT scripts on github:


Other related posts that you may find useful are:

PureMVC Super Simple Example Simple PureMVC Application on GitHub PureMVC State Management with StateMachine