Hello,
I'm trying to get an app working where the modules are loaded from SWFs, then connected to the shell using pipes. I'm following the Pipe Works demo application. The module loads fine, but when the shell tries to send a message to the module, it gets a "null object reference" exception being thrown by the Pipe class. The Pipe's 'output' variable is null, so it seems something is not getting initialized properly.
The weird thing is, after stepping through the module code in the debugger, it looks like notifications aren't getting sent within the module's core. The module's StartupCommand gets called, and registers the junction mediator and other mediators, but these mediators never respond to notifications.
Here's the shell's junction mediator method where it wires up the connection to the module:
override public function handleNotification(note:INotification):void { switch (note.getName()) { case ApplicationFacade.MODULE_LOADED: var moduleVo:ModuleInfo = note.getBody() as ModuleInfo; var module:IPipeAware = moduleVo.module as IPipeAware; trace ("Connecting pipes to module " + moduleVo.name); // Connect module's OUT pipe to this app's IN pipe. var moduleToApp:Pipe = new Pipe(); module.acceptOutputPipe(PipeAwareModule.STDSHELL, moduleToApp); var appIn:TeeMerge = junction.retrievePipe(PipeAwareModule.STDIN) as TeeMerge; appIn.connectInput(moduleToApp); // Connect app's OUT pipe to module's IN pipe. var appToModulePipe:Pipe = new Pipe(); module.acceptInputPipe(PipeAwareModule.STDIN, appToModulePipe); var appOut:IPipeFitting = junction.retrievePipe(PipeAwareModule.STDOUT) as IPipeFitting; appOut.connect(appToModulePipe); break; case ApplicationFacade.EXPORT_MODULE_VIEW: trace ("Exporting module's view..."); junction.sendMessage(PipeAwareModule.STDOUT, new Message(PipeModuleConstants.EXPORT_MODULE_VIEW, this, "Conneced to EDU Client")); break; default: // Let super handle the rest (ACCEPT_OUTPUT_PIPE, ACCEPT_INPUT_PIPE) super.handleNotification(note); break; } }
I'm stumped at the moment. Any suggestions/guidance will be greatly appreciated.
Thanks, Stephen
|