I have a fringe use case here, and I think it may be a simple fix but
I'm a little stumped.
I have a shell Flex application loading modules via ModuleLoader. When
a module is instantiated I also add a reference to it in a ViewLocator
class (singleton) containing a hash map. For instance, when Module1 is
loaded, the constructor for Module1's code-behind class (Module1Base)
references the ViewLocator, like so:
class Module1Base
{
public function Module1Base()
{
// some code
ViewLocator.getInstance().addView(this);
}
.
.
.
}
There is a case where I am loading additional modules into the same
ModuleLoader that Module1 occupies. For instance, I want to load
Module2 into said ModuleLoader. Subsequently, I will want to load
Module1 back into the aforementioned ModuleLoader. I am having
difficulty figuring this part out. I am attempting to set the
ModuleLoader's child property to the existing reference in the
ViewLocator, like so:
// after Module1 was loaded, then another module (e.g. Module2)
// then back to Module1
m = moduleLoaderInMainApp;
m.child =
ViewLocator.getInstance().getView(getQualifiedClassName(Module1));
Does anyone have any idea if this can be done, or how to do it?
Thanks,
Thomas