Build modular site with multiple Context ?
In the case of a pure as3 site with multiple parts.
For ex: a main.swf that load/unload several SWF: portfolio.swf,
contact.swf, ...
Each SWF have is own Context instanciate in each Document class : MainContext, PortfolioContext, ContactContext
There is recommandations/good pratice to "wire/unwire" the Contexts together ?
Perhaps its a good idea to add this case in the RL demo bundle.
Thanks
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Stray on 29 Jan, 2010 12:29 PM
There's a utility set for modular applications. In the mvcs pacakge you'll find three classes: ModuleContext, ModuleContextView and ModuleMediator.
As you describe - each swf has its own context. In this case, you extend the ModuleContext. Each module is also mediated by a ModuleMediator. The module's main view should extend ModuleContextView.
Inside your module you just use the normal Robotlegs classes.
The utilities also provide a special EventDispatcher and CommandMap for inter-context wiring: ModuleEventDispatcher, ModuleCommandMap.
So far, I've been following a practice of only allowing the top level ModuleMediator in each swf to directly access the ModuleEventDispatcher and ModuleCommandMap. My module mediators control the flow of events between the module's internal event bus and the inter-module event bus.
Basically - the mediator relays system-wide messages from other modules into its own event map, and its own internal messages onto the shared module event map. This makes it easier to recognise which events matter to which modules.
The module utils are at: http://github.com/Stray/robotlegs-utilities-Modular
I did a brief demo here: http://github.com/Stray/robotlegs-modular-e-learning-demo
I'm using RobotLegs in building a large modular app every day at the moment, so if you have any questions fire away!
3 Posted by jadd on 22 Feb, 2010 09:48 AM
Hi Jerome Is there any basic implementation of your approch you can share? Thanks a lot.
Stray closed this discussion on 11 Feb, 2011 11:28 PM.