I am using interfaces for module communication like in adobe flex documentation. When I have a ModuleLoader in mxml, everything works great.
<mx:TabNavigator id="testNav"
height="100%"
width="100%">
<s:ModuleLoader id="firstTab"
label="ONE"
width="100%"
url="path/to/module/Mod1.swf"/>
<s:ModuleLoader id="secondTab"
label="TWO"
width="100%"
url="path/to/module/Mod2.swf"/>
</mx:TabNavigator>
and i have this code
var someChild:* = firstTab.child as ISomeModule;
ISomeModule is the interface. But when I have a ModuleLoader in actionscript in another file, when I do the same thing, someChild becomes null when cast to ISomeModule
var myLoader:ModuleLoader=new ModuleLoader();
myLoader.percentHeight=50;
myLoader.percentWidth=50;
myLoader.loadModule(moduleURL + "?attr=value&attr2=" + parentDocument.attr2);
and in another function, I have
var childMod:* = myLoader.child as ISomeModule;
myLoader.child
is not null but when cast to ISomeModule, it becomes null.
Does anyone have an idea about how to solve this?
thanks
2 things:
<s:ModuleLoader url="someURL" applicationDomain="{ApplicationDomain.currentDomain}" />
firstChild.content
and not firstChild.child
for the actual module itself.