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

Pages: [1]
Print
Author Topic: questions about moduleAddress and parent access  (Read 9019 times)
krange
Newbie
*
Posts: 8


View Profile Email
« on: June 01, 2009, 02:26:45 »

Hi,

First of all great work on the fabrication utility. I have it setup in a few of my projects and it's been extremely useful. In one of my projects  we load in multiple modules, and those modules then load in other modules as well (see diagram below).

Shell --> Module A     --> Module C
                              --> Module D
                              --> Module E
                              --> Module F

       --> Module B      --> Module C
                              --> Module D

       ---> Module ....

I have two questions:

1. I have set it up so that currently the shell or module that is loading a module in passes it it's moduleAddress class and instance name. This way the module loading in can get direct access to the parent it was loaded from. Since a parent can be anything from the shell to a few different types of modules, I didn't see any other way of getting this information. Is this the correct way to go about this?

2. I've also noticed that the FlexModuleLoader instance isn't providing me with the modules moduleAddress information. It always seems to show up null. I can grab other information from the loader, but just not the moduleAddress. So if I need to go the other direction and send information into the specific module instance, I can't grab the information correctly. Any initial thoughts as to why this might be? Is there another way I should go about this? Attached is my code for loading the module ( commented out some that was extraneous )....

:
var loader : FlexModuleLoader = new FlexModuleLoader();

loader.url = moduleVO.moduleSwfUrl;
loader.id = moduleVO.id;
loader.router = applicationRouter;

if ( moduleVO.moduleGroup != null ) {
loader.moduleGroup = moduleVO.moduleGroup;
loader.defaultRoute  = moduleVO.moduleGroup;
} else {
loader.defaultRouteAddress = applicationAddress;
}

// Event listening code here...

// Save loader reference here...

loader.loadModule();

Thanks,
Kris

Logged
bir
Newbie
*
Posts: 1


View Profile Email
« Reply #1 on: June 25, 2009, 03:02:35 »

1) That is the same way I do it, passing a reference to the parent router and address as the body of an initModule notification sent to the loaded module.

2) I noticed the same issue with moduleAddress.  Instead I use: module.moduleFabricator.moduleAddress

:
var module:FlexModuleLoader = modulesContainer.getChildAt(event.oldIndex) as FlexModuleLoader;
routeNotification(ControllerConstants.LEAVE_MODULE, proxy.state, null, module.moduleFabricator.moduleAddress);

Logged
Pages: [1]
Print