You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mark goldin <ma...@gmail.com> on 2015/09/12 22:37:52 UTC

Accessing non-visual module

I am creating mx applications that all would share some common data. I am
thinking to make a mx:Module to be a loader for that data. I have designed
one and here is my code:
private var info:IModuleInfo;

info = ModuleManager.getModule("dataLoader.swf");
info.addEventListener(ModuleEvent.READY, modEventHandler);
info.load(null, null, null, moduleFactory);

private function modEventHandler(event:ModuleEvent):void {
this.createComponentsFromDescriptors(true);
        var globalArea:dataLoader = info.factory.create() as dataLoader;
}
While globalArea has all public properties of dataLoader they are all null.
What am I doing wrong?

Thanks

Re: Accessing non-visual module

Posted by Alex Harui <ah...@adobe.com>.
Using a class in the loading SWF defeats the purpose of modules as the
class will be linked into the loading SWF as well as the module.  So if
dataLoader is a class and not an interface, you must define an interface
to use to communicate.

I don’t know why the properties are null though.

-Alex

On 9/12/15, 1:37 PM, "mark goldin" <ma...@gmail.com> wrote:

>I am creating mx applications that all would share some common data. I am
>thinking to make a mx:Module to be a loader for that data. I have designed
>one and here is my code:
>private var info:IModuleInfo;
>
>info = ModuleManager.getModule("dataLoader.swf");
>info.addEventListener(ModuleEvent.READY, modEventHandler);
>info.load(null, null, null, moduleFactory);
>
>private function modEventHandler(event:ModuleEvent):void {
>this.createComponentsFromDescriptors(true);
>        var globalArea:dataLoader = info.factory.create() as dataLoader;
>}
>While globalArea has all public properties of dataLoader they are all
>null.
>What am I doing wrong?
>
>Thanks