A basic PureMVC MultiCore AS3 example using Pipes Utility and Modules

Posted on June 21, 2008

These days I've been playing around with the latest cool utility for PureMVC MultiCore AS3 called "Pipes Utility" developed by Cliff Hall. It's a very helpful and powerful utility to communicate among all core actors of a module based application using PureMVC.

For a better understanding I created a basic example using modules. It's just a simple app called "HelloPipes", which loads and unloads a module for communicating with its shell using Pipes. Module and shell are acting as a core based on PureMVC MultiCore AS3.

The following example including full source may help anybody who is interested in the new Pipe Utility too ;-) .


Tips using Modules, PureMVC MultiCore AS3 and Pipe Utility

  • Don't import any classes of a PureMVC MultiCore module within the shell (main application) to avoid any issues at runtime loading and unloading a module. To define constants for using Pipes such as output and input pipe names, which are shared between shell and module, don't use a reference to any actor. Use a simple "common" class instead, which stores only these constants for sharing by shell and module. Check the PipeAwareModuleConstants.as within the example above.
  • For communicating from shell to module and return without Pipes use well defined interfaces for the same reason mentioned before.
  • Clean up your module to avoid any issues loading and unloading it again. This may be helpfull for a successful garbage collection as well. Check out the code for the module within the example above, which uses an Interface called IPipeAwareModule. Using this interface the shell forces the cleaning up process of the module before the module will be unloaded.
  • Disconnect and unregister (if necessary) Pipes connecting shell and modules, when a module is unloaded.
  • Remove all PureMVC core actors of a module using facade.removeCore before a module is unloaded to avoid issues reloading it.
  • General issue: To reduce the file size of a module use the compiler option called load-externs. For detailed information check the Flex 3 Help: "Compiling modules - Reducing module size"

Helpful links

Full source


UPDATE (08/25/08)

Source has been updated using PureMVC 1.0.5 MultiCore.

Have fun! ;-)

Any feedback?

comments powered by Disqus