Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / General Discussion / Unable to get instance of a facade in multicore on: July 29, 2008, 01:43:42
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?


2  Announcements and General Discussion / General Discussion / Notification firing multiple times in multicore version on: May 09, 2008, 08:47:45
This issue is going to take some explanation.

First I have an application that uses dynamically loaded modules. To support this the main application mxml file contains a load module method that calls the currently loaded module and tells it it is going away, tells the main application's facade to remove core for the facade of the loaded module, sets the module loader's url to an empty string, finally sets the module loader's url to the new swf file. This appears to be working correctly and modules load as expected.

In the module where I'm having the problem, the your going away method does a remove core for the module's facade in an attempt to clear all of the facade related data.

With the above as background here's what is happening:

The loaded module (new doc panel) accepts data from the user then calls a proxy to post that data to a remote server. When the remote service call completes a notification is sent from the proxy. This works as expected.

User enters the module first time, files in the fields, and the new doc is sent to the server. Debug trace shows the proxy call is made and the completion notification received as expected.

The user then clicks in the menu to access the same module again. The app module load method follows the process described above and reloads the module. User enters new data for the second document and the proxy is called. Debug trace shows that the proxy is called once as expected, but the completion notification is received twice.

The user repeats the process, select the module from the menu, module loads again, user completes fields. Trace shows the proxy is called once as expected, but the completion notification is received three times.

Using debug and stepping through the code I can see that a new facade instance is being created for the module each time that it is being loaded. The question is where is the notification being stored so that it is firing multiple times? As it fires once for each time the module has been loaded I have no idea what is happening. Based on debug tracing I can only find the module in memory once. Is there something going on with PureMVC that is causing this?

Any ideas or help will be greatly appreciated.
Pages: [1]