john.amedo's Avatar


07 Aug, 2012 02:57 PM

Hey there.

This support forum helped recently, so I am trying it again.

I am using the modular utility by joel hooks, and am having an issue regarding the ContextEvent.STARTUP_COMPLETE event.

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.

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.

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?

Any help is appreciated.

Thanks much,

  1. 1 Posted by Stray on 07 Aug, 2012 03:05 PM

    Stray's Avatar

    Can you not just unmap the module loading function (or command) from the STARTUP_COMPLETE event in the parent the first time it fires?

    If you're doing it via a command then just make sure you set the 'once' parameter to true.


  2. 2 Posted by john.amedo on 07 Aug, 2012 03:19 PM

    john.amedo's Avatar


    commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE, InitializeCommand, ContextEvent, true);

    This is the mapping in the parentSWF. I already have the 'true' in there. Which is why I was confused.

    I will try un-mapping that command.

  3. 3 Posted by john.amedo on 07 Aug, 2012 05:02 PM

    john.amedo's Avatar

    I un-mapped the command inside the command itself, at the end of the execute function. That did not work.

    Still catching that STARTUP_COMPLETE somehow.

    Going back to look to see if I made a mistake somewhere.

  4. 4 Posted by john.amedo on 08 Aug, 2012 04:01 PM

    john.amedo's Avatar

    Anyone have any ideas here?

    I am trying to find the problem, but have not identified anything yet.

    Even after un-mapping the event, it still falls into a loop on the command.

    Anyone ever have issues with multiple contexts, being loaded at runtime?

  5. 5 Posted by Stray on 08 Aug, 2012 04:05 PM

    Stray's Avatar

    Hi John,

    I'm afraid I've never seen this, and never heard of it before.

    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?


  6. 6 Posted by john.amedo on 08 Aug, 2012 04:35 PM

    john.amedo's Avatar

    Found the issue.

    It had to do with a duplicate class name issue.

    The two SWFs, parentSWF, and childSWF, each have their own AS3 projects where the SWF is built.

    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.

    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!

    This led me to rename the class. Once I did this, the strange looping error went away. Interesting.

    On to the next issue, but I will open a new discussion.

    Thanks Stray.

  7. Ondina D.F. closed this discussion on 14 Aug, 2012 06:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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