Robotlegs 1 and Modules
I came across a strange problem regarding Modules.
I am trying to create a modular robotlegs application. Flash Builder is annoyed (gives warning) by referencing the Module directly inside the application. It says that its better to create an interface and then reference that. I totally agree with it as referencing the Module directly inside our application defies the logic behind having modules in the first place: to load/unload specific parts of the application at will.
Now, the only way I can find for using the modular robotlegs is to reference the module directly, because I will have to use:
viewMap.mapType( MyModuleType );
Which also makes it silly to use the ModuleLoader to load the module, because the module is already directly compiled into the software... AND it actually doesn't work and results in strange errors inside adobe's framework where I cannot reach.
And if I don't use ModuleLoader, then again, I am referencing the module itself as in:
<MyModuleType width="100%" height="100%"/>
was wondering if anybody came across a solution for this
problem.
Thanks for your support,
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
1 Posted by Stray on 31 Jul, 2012 09:23 AM
Hi there,
implement a method in your own custom module interface which returns the concrete type:
public function getViewMappingType():Class
and then do the view mapping programmatically.
hth,
Stray
2 Posted by mbarjawi on 31 Jul, 2012 07:19 PM
Thank you Stray for your help.
So I created an interface like this:
Then modified my Module by using the implements tag like this:
Then implemented the interface method inside the script tag of the Module, like this:
Now, inside my application's context, I created a new public function
And inside my main application, I listened for the
ready
event for the ModuleLoader. Inside the handler, I called themainContext.mapSkillPlanModule();
method.Things work, and I can trace inside the code and can get to the module's context...etc. However a new strange bug was introduced,,, inside my Module, I simply have one view
MyModuleView
. I am getting the following error:So I am not sure what this bug is all about... since everything works fine when not using ModuleLoader and just referencing the Module directly.
But since the bug happens somewhere near swiftsuspenders and robotlegs, I thought you might have an idea.
One last note, once I click "continue" on the "error" box, the
MyModuleView
does load but nothing in it works (which means the mediator didn't run and the handlers are not set).I tried removing the
from the module context, compile, and run... I don't get the error anymore, but still nothing works in the view as the Mediator didn't run.
Thanks again for you time and help,
Support Staff 3 Posted by Ondina D.F. on 01 Aug, 2012 12:22 PM
Hi,
Regarding the error:
The error message you’ve got says something about ApplicationDomain.
Could it be that you forgot to define it?
<s:ModuleLoader id="moduleLoader" applicationDomain="{ApplicationDomain.currentDomain}"
P.S.
I’ve just tried an rl1 modular app, and I get the same errors when I omit setting the applicationDomain.
4 Posted by mbarjawi on 01 Aug, 2012 05:57 PM
Thank you so much Ondina for your response.
Yes you were correct. I actually never used the
applicationDomain
property whenever loading modules... I wasn't aware of it.It seems that it is a must to use the
applicationDomain
property when using reflection which I think is being utilized in robotlegs.Thanks for both of you for all your help.
mbarjawi closed this discussion on 01 Aug, 2012 05:58 PM.