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: Solved: Multiple flash modules at the same time  (Read 11714 times)
j00
Newbie
*
Posts: 4


View Profile Email
« on: April 02, 2009, 08:25:25 »

Hi just found there is a fabrication section,

I have a minor problem with multiple flash modules.
Seems that only the first module that is loaded into the shell works, so I can't get notification bodies from
the rest of the modules. The notifications seem still to trigger.

If I don't define router, routeNotifications won't go between modules (I use wildcard for recipient).
When I define it, only the first module that is loaded works.

Any pointers to the right direction are appreciated!

:
var module:FlashApplication = navModuleLoader.content as FlashApplication;
module.router = applicationRouter;
module.defaultRouteAddress = applicationAddress;


ps. fabrication is a very, very nice utility! thanks
« Last Edit: April 07, 2009, 06:46:14 by j00 » Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 on: April 02, 2009, 09:58:24 »

It's really hard to say without seeing more code. Have you tried debugging to see what's going on?
Logged
j00
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: April 02, 2009, 12:15:48 »

Yeah I have debugged. It goes like this:
without defining router --> module notification body is correct, but fails to route it.

defining router to be applicationRouter --> module notification body is undefined, but routing works.
i.e. notification is sent and received, notification body is undefined. (still works well for the first module)

So everything in modules works stand-alone, but routing notifications between modules only
happens with the first module.

I think the router is somehow causing the problem.
Looks that I can set it only for the first module.
Should I configure router differently than in case of just one module?

I have mainly extended the flash module example code to have more than one module,
loading is done in a similar fashion with as3-only loader.

I have also noted that flex examples use UID for multimodules,
should I generate some UID for flash modules as well?

all tips are welcome..


Logged
j00
Newbie
*
Posts: 4


View Profile Email
« Reply #3 on: April 07, 2009, 06:45:21 »

Well, this is solved now.
The problem was not with the fabrication..but the way I handled variables in modules.

Fabrication works very well. thanks
Logged
louisstow
Newbie
*
Posts: 3


View Profile Email
« Reply #4 on: September 09, 2009, 04:43:07 »

I'm having the exact same problem. How did you resolve this? My variable scoping seems fine

To reiterate, if I load modules like this:

Module A -> Module B -> Module C

And route notification from Module C to '*', then Module A responder fires but not Module B.

Compiling just Module B -> Module C the responder within Module B fires on a routeNotification from C.

Looking in the debugger it seems all loaded modules are only being piped to the root module?  Not setting the default route address made no difference.

Should I be using something other than module.router = applicationRouter to set routes for multiple modules? I'm using Flash with fabrication, not Flex.
Any help would be great!
Logged
j00
Newbie
*
Posts: 4


View Profile Email
« Reply #5 on: September 23, 2009, 06:32:05 »

the first code example in this thread is the correct way. If I remember correctly the problem was related to loaderContext. so you might try setting applicationDomain to same as the module that loads other modules.

sorry for late answer..
Logged
Pages: [1]
Print