startup method not getting called in modular contexts
a context extending ModuleContext does not getting it's
overriden startup method called.
injection mapping and event dispatching (to the core) is working
fine, though - i'm calling the startup method from the constructor
of the modular context to work around this for now.
intended - or am i missing something?
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 tom on 04 Jun, 2010 09:28 PM
due to this issue i need to call startup() in the context's constructor to get the mapping done. unfortunately, this seems to be too early. every few reloads of the same swf commands mapped using moduleCommandMap.mapEvent() won't get triggered.
this seems only to be the case when the event gets dispatched from a ModuleMediator using dispatchToModule() - it's call to moduleDispatcher.hasEventListener() returns false when the command isn't getting called.
please assist, thank you.
Support Staff 2 Posted by Joel Hooks on 04 Jun, 2010 09:34 PM
You're gonna need to post some code Tom. The startup method DOES get called, but there is some weirdness revolving around ADDED_TO_STAGE and the startup method in the base Context.
Support Staff 3 Posted by Joel Hooks on 04 Jun, 2010 09:35 PM
When I say does it called, it does in my examples, so there is something happening in your application that is blocking it.
4 Posted by tom on 04 Jun, 2010 10:00 PM
i've implemented my code following your tutorial at http://joelhooks.com/2010/05/02/modular-robotlegs/
module's main class
and the context
and the mediator (from the application)
when autoStartup is set to false the command will never get called, set to true works sometimes (per reload).
pretty strange, guess you are right, something related to ADDED_TO_STAGE.
5 Posted by tom on 04 Jun, 2010 10:21 PM
i should add that each module is compiled to a separate SWF. application and modules only share some events. thinking over this again i just realized that the modular views are never added to stage as the main application does not declare them - quite logical that this results in startup() not being called.
i'd like to keep code sharing down to a minimum. guess i need to find a way to manually call the startup method from inside the module or add the module to the display list.
Support Staff 6 Posted by Joel Hooks on 04 Jun, 2010 11:41 PM
http://github.com/robotlegs/robotlegs-framework/blob/master/src/org...
Here is the method in the mvcs context that is likely bullying you. I'm actually surprised that calling startup after super in your constructor is failing. Perhaps overriding checkAutoStartup() in your context and just calling startup there would do the trick? It is about the same thing really, but perhaps a little more explicit.
7 Posted by tom on 08 Jun, 2010 11:27 AM
hell yeah that's working. thanks a million!
8 Posted by tom on 09 Jun, 2010 10:25 AM
doh, i got happy too early, the command isn't getting mapped every now and then.
Stray closed this discussion on 10 Feb, 2011 05:26 PM.