I am using the Multicore version of PureMVC in a good sized Flex project. The application is broken into a number of dynamically loaded modules and each has its own facade. Users select a module by clicking on items in a menu bar.
Most of time things work as expected, but if you click quickly between items in the menu bar or if you switch quickly back and forth between modules, you can cause a problem with the facade get instance code. Symptom of the problem is facade winds up being null in the newly loaded module.
I first thought the problem was related to switching modules before a module had fully loaded and added code to my load routine to ensure that one module is "ready" before I permit a switch to a new module. When switching I call remove core to clear out the PureMVC core for the module going out of scope (and out of memory).
Carefully controlling the swap between modules has reduced the times when we see the problem, but it has not gone away. Modules contain the code creationComplete="moduleInit();" and in the moduleInit() function you find:
public function moduleInit():void
{
//Create an instance of MyTeamFacade
facade = teamFacade.getInstance(getModuleKey());
facade.startup(this);
}
The error that occurs points to the facade.startup(this); statement because facade is null.
Anyone have any suggestions on how to figure out what's going on here?