tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/989-modular-start_completeRobotlegs: Discussion 2012-08-14T18:03:24Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-07T14:57:08Z2012-08-07T14:57:08ZModular START_COMPLETE<div><p>Hey there.</p>
<p>This support forum helped recently, so I am trying it again.</p>
<p>I am using the modular utility by joel hooks, and am having an
issue regarding the ContextEvent.STARTUP_COMPLETE event.</p>
<p>Situation: parentSWF, loads a moduleSWF after the
ContextEvent.STARTUP_COMPLETE is fired in parentSWF. moduleSWF
loads fine, but it is clear that the ContextEvent.STARTUP_COMPLETE
that is firing from the moduleSWF, is being caught in the parentSWF
context.</p>
<p>This is causing a loop. STARTUP_COMPLETE fires in parentSWF.
Loads module. moduleSWF STARTUP_COMPLETE fires, and is caught in
the parentSWF. Which then repeats everything.</p>
<p>What am I missing? Is there a ModuleContextEvent I should be
catching instead? How do I limit this event to the context that
particular context/module?</p>
<p>Any help is appreciated.</p>
<p>Thanks much,<br>
John</p></div>john.amedotag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-07T15:05:53Z2012-08-07T15:05:53ZModular START_COMPLETE<div><p>Can you not just unmap the module loading function (or command)
from the STARTUP_COMPLETE event in the parent the first time it
fires?</p>
<p>If you're doing it via a command then just make sure you set the
'once' parameter to true.</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-07T15:19:32Z2012-08-07T15:19:32ZModular START_COMPLETE<div><p>Hmmm.</p>
<p>commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE,
InitializeCommand, ContextEvent, true);</p>
<p>This is the mapping in the parentSWF. I already have the 'true'
in there. Which is why I was confused.</p>
<p>I will try un-mapping that command.</p></div>john.amedotag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-07T17:02:39Z2012-08-07T17:02:39ZModular START_COMPLETE<div><p>I un-mapped the command inside the command itself, at the end of
the execute function. That did not work.</p>
<p>Still catching that STARTUP_COMPLETE somehow.</p>
<p>Going back to look to see if I made a mistake somewhere.</p></div>john.amedotag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-08T16:01:52Z2012-08-08T16:01:52ZModular START_COMPLETE<div><p>Anyone have any ideas here?</p>
<p>I am trying to find the problem, but have not identified
anything yet.</p>
<p>Even after un-mapping the event, it still falls into a loop on
the command.</p>
<p>Anyone ever have issues with multiple contexts, being loaded at
runtime?</p></div>john.amedotag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-08T16:05:00Z2012-08-08T16:05:00ZModular START_COMPLETE<div><p>Hi John,</p>
<p>I'm afraid I've never seen this, and never heard of it
before.</p>
<p>Can you throw an error in the handler second time around (just
use a global flag for that) and then use the stacktrace to find out
exactly what the chain of events is?</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/178732062012-08-08T16:35:42Z2012-08-08T16:35:42ZModular START_COMPLETE<div><p>Found the issue.</p>
<p>It had to do with a duplicate class name issue.</p>
<p>The two SWFs, parentSWF, and childSWF, each have their own AS3
projects where the SWF is built.</p>
<p>Inside of each of these projects I have a folder structure of
'controller/bootstrap/'. Inside of this folder, is
BootstrapModels(injector), BootstrapCommands(commandMap,
moduleCommandMap), etc.</p>
<p>I went in and commented out each one, and it turns out, that the
BootstrapCommands class was causing the error I was having. So I
then went in and commented out everything in that class with the
exception of the constructor. And the error was still
happening!</p>
<p>This led me to rename the class. Once I did this, the strange
looping error went away. Interesting.</p>
<p>On to the next issue, but I will open a new discussion.</p>
<p>Thanks Stray.</p></div>john.amedo