Modular Robotlegs 2 -- How to?
Dear forum,
I've seen this discussion passing a few times before, but all of the examples/solutions I can find were written with an older version/implementation of the config files, which got me pretty confused.
What I'm trying to do is:
I made a very basic application which loads modules (just one, in
this case).
I assume that every module should have its own Config file, which
maps its own mediators, commands, etc etc.
Now, the module loader seems to be working correct (I THINK),
but I think I am loading my config file in the first module in the
wrong way.
I know there are a lot of ways to use modules in an app, but I
would like to have my module 'hooking up' with the shell, so I can
just dispatch events 'everywhere'.
I just want to keep the advantage that when I will "disable" (or
just: 'not load') a module one day, my main file isn't 3MB because
of a part that's not being used anymore.
So can someone please help me out here?
If I can get a clean implementation, I will finish this and maybe
we can add this project to the RL2 examples afterwards if you'd
like.
My project can be found here: https://github.com/dotdotcommadot/ModularRL
Just add robotlegs to the library path, and you can run it.
The error I am seeing is this:
Error: Child context Context-1-43 must be uninitialized
at robotlegs.bender.extensions.vigilance::VigilanceExtension/log()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/extensions/vigilance/VigilanceExtension.as:50]
at robotlegs.bender.framework.impl::LogManager/log()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/LogManager.as:89]
at robotlegs.bender.framework.impl::Logger/warn()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/Logger.as:70]
at robotlegs.bender.framework.impl::Context/addChild()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/Context.as:321]
at robotlegs.bender.extensions.modularity.impl::ViewManagerBasedExistenceWatcher/onContextAdd()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/extensions/modularity/impl/ViewManagerBasedExistenceWatcher.as:98]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at robotlegs.bender.extensions.modularity::ModularityExtension/broadcastContextExistence()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/extensions/modularity/ModularityExtension.as:95]
at robotlegs.bender.extensions.modularity::ModularityExtension/beforeInitializing()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/extensions/modularity/ModularityExtension.as:82]
at MessageRunner/next()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/MessageDispatcher.as:144]
at MessageRunner/run()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/MessageDispatcher.as:127]
at robotlegs.bender.framework.impl::MessageDispatcher/dispatchMessage()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/MessageDispatcher.as:79]
at robotlegs.bender.framework.impl::LifecycleTransition/enter()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/LifecycleTransition.as:191]
at robotlegs.bender.framework.impl::Lifecycle/initialize()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/Lifecycle.as:148]
at robotlegs.bender.framework.impl::Context/initialize()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/Context.as:154]
at robotlegs.bender.extensions.stageSync::StageSyncExtension/initializeContext()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/extensions/stageSync/StageSyncExtension.as:85]
at robotlegs.bender.extensions.stageSync::StageSyncExtension/handleContextView()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/extensions/stageSync/StageSyncExtension.as:67]
at ObjectHandler/handle()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/ObjectProcessor.as:89]
at robotlegs.bender.framework.impl::ObjectProcessor/processObject()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/ObjectProcessor.as:48]
at robotlegs.bender.framework.impl::ConfigManager/addConfig()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/ConfigManager.as:91]
at robotlegs.bender.framework.impl::Context/configure()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/framework/impl/Context.as:308]
at robotlegs.bender.mxml::ContextBuilderTag/configureBuilder()[/Users/admin/FlexWorkspace/robotlegs/src/robotlegs/bender/mxml/ContextBuilderTag.as:103]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
(To me it seems like a contradiction that the VigilanceExtension is dispatching this error allthough the ModularityExtension is installed by default. But I'm probably looking in the wrong direction anyway...)
Are there any tips, or is it just me making no sense at all?
Also, I don't know but in Shell.as, on line 34 I load my module
like this:
moduleInfo.load( null, null, null, moduleFactory
);
Maybe I should use
moduleInfo.load( ApplicationDomain.currentDomain, null, null,
moduleFactory );
instead? (however, for the moment both are
giving me the same error).
Thanks in advance!
Hans
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Shaun Smith on 19 Jan, 2013 02:00 PM
Hello Hans,
I haven't had a chance to look at your sample application yet, but that initialization check was added fairly recently, so it's entirely possible that this is my fault! I think there is a timing issue here.
When a child context is added to a parent context, that child must be uninitialized to ensure that it inherits everything it needs from the parent before it starts up. Otherwise it might create it's own mappings for things that it should be inheriting and by then it would be too late to change.
Thanks for putting the sample together - it should help me figure out what is going on here (I suspect it's due to a delay that I added to the ContextBuilderTag).
Support Staff 2 Posted by Shaun Smith on 19 Jan, 2013 04:43 PM
Hey Hans,
I've committed a fix to the Modularity Extension - it was previously locked in an impossible situation where a module would only broadcast its existence during initialization.. but by then it was too late!
This fix will be released in the next Beta. In the meantime you can checkout the source from GitHub.
Support Staff 3 Posted by Shaun Smith on 19 Jan, 2013 06:40 PM
Also, I added this change to your sample:
https://github.com/darscan/ModularRL/commit/ee077e033e6ba02d268fbf8...
That way the mediator in the sub module actually gets created. I'll need to adress this soon.
Support Staff 4 Posted by Shaun Smith on 20 Jan, 2013 12:51 AM
Ok, ignore that fix. I've added an extension to the MVCSBundle that scans for views that are already on stage when the context initializes. New beta soon.
Support Staff 5 Posted by Shaun Smith on 20 Jan, 2013 01:02 AM
I've released RL2 beta-4
6 Posted by dotdotcommadot on 21 Jan, 2013 09:35 AM
Damn, thank you so much!!!
Works like a charm :)
I'll probably be doing a LOT of robotlegsing in the coming year, so hopefully I can contribute from time to time where ever and however needed.
Again, thanks man!
Hans
Support Staff 7 Posted by Ondina D.F. on 22 Jan, 2013 10:32 AM
Hi Hans,
I’ve moved this discussion to http://knowledge.robotlegs.org/discussions/robotlegs-2, where you can either reopen this one, or open new discussions regarding rl 2.
That would be cool:)
Ondina
Ondina D.F. closed this discussion on 22 Jan, 2013 10:32 AM.
dotdotcommadot re-opened this discussion on 23 Jan, 2013 04:14 PM
8 Posted by dotdotcommadot on 23 Jan, 2013 05:06 PM
damnit, re-opened to soon.
Sorry!
Anyway, TIP: if you use the custom extensions, make sure to add them both to the shell's bundle as to the module's bundle.
dotdotcommadot closed this discussion on 23 Jan, 2013 05:06 PM.