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: Connection between modules  (Read 7505 times)
Corax


Email
« on: June 15, 2011, 03:50:18 »

Hi everybody,

I've a problem and I hope you can help me to handle it.

The scenario:
I have a multicore-app which contains an unknown number of modules. One of these modules is responsible for the login.
If the user logs in, the login-module sends a message to the shell which contains informations about the accessible modules.
To access these modules the shell has a buttonbar, which loads the module-links.
If the user clicks on one button, a module will be registered with all it's components. So far so good.
But know I would like to send data from the login-module directly to the new modules because in some cases I just want to show particular data.
What shell I do?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: June 15, 2011, 07:51:01 »

There are two major approaches you can take here.

1) You can have the shell give the modules a reference to each other so that they can call methods on each other (or just one-way; the new module might know the login module, but not visa-versa). This approach will be most loosely coupled if you use interfaces to interact with rather than references to the module classes themselves.

2) You can 'plumb' it to the login module using the pipes utility. A pipe allows you to send messages to one or more modules connected to the pipe without having a reference to those modules.

If you aren't familiar with the Pipes utility, you can get a quick overview of it here:
http://puremvc.tv/#P002/

And download it here:
http://trac.puremvc.org/Utility_AS3_MultiCore_Pipes

-=Cliff>
Logged
Pages: [1]
Print