Hi,
I am writing some code to load modules dynamically. Each module is implemented as a standalone application (meaning it has it's own Facade, Model, View and Controller). I am using (in my shell application) a ModuleProxy, which loads and unloads modules. While they are loaded, the proxy keeps a reference in an ArrayCollection.
The strange thing is, I can load a module perfectly the first time, then unload it without any problems, and if I want to load it again afterwards, I get an error in the module's main mxml (which has the Module tag), saying that it "cannot access a property or method of a null object reference". This happens in the creationComplete event handler which looks like
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="
http://www.adobe.com/2006/mxml"
verticalGap="0"
horizontalGap="0"
creationComplete="facade.startup(this);">
<mx:Script>
<![CDATA[
import my.name.space.ApplicationFacade;
public static const NAME:String = 'MyModule';
protected var facade:ApplicationFacade = ApplicationFacade.getInstance(NAME);
]]>
</mx:Script>
...
</mx:Module>
so that means, the null object reference is the facade object, right?
Now, what does this exactly mean? Why is it null the second time I try to load the module, but not the first time?