This content has been marked as final. Show 3 replies
Thanks for the reply, I've read that before, but it doesn't help the problem.
It does not cover anything about dispatching "custom" events, only
the standard module loading events that tell the state of the module
being loaded, such as the "ready" event in your example.
I need to dispatch an event from a Module that is already loaded and being used.
When the user clicks on a button in the module, dispatch an "prodAdded" event or some other name,
same for other functions. Normally you can attach those listeners in the tag with
the component as long as they are declared in the component with an [Event] as metadata
and then put the listener in the call to the tag i.e.
<v:Customcomponent width="100%" added="addFunction()" deleted="delFunction()"/>
however you cannot attach those listener attributes to a ModuleLoader tag even though the Module
may have an [Event] tag inside Metadata tags, it throws an error. I even tried putting "bubbles="true"
on the event declaration, hoping it would bubble to the shell application, but still no success.
I figured it out.
1. Since you cannot attach the events listener to the <mx:ModuleLoader> tag like you can for a custom component
you must add the listener with actionscript. moduleName.addEventListener('eventName', functionToRun);
2. Within the module set the bubbles parameter to "true" on your dispatchEvent call so the shell application receives it.
I was putting the bubbles setting in the Modules Event declaration.
It works as expected now.