I would try

Panel.addChild(mod2)


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
ilikeflex
Sent: Friday, November 07, 2008 3:12 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ModuleLoader does not load module when instance is 
created as ModuleLoader()


Hi

I am trying to load module as show below. I am using

panel.addChild(mod2.child);

but i never see module loaded in the panel.
It is very simple app.I do not know why the module is not being
loaded .

Any pointer is highly appreciated.

I have been putting my head for last 4 hours.

Thanks
ilikeflex

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
<mx:Script>
<![CDATA[
import mx.events.ModuleEvent;
import mx.modules.ModuleLoader;
import mx.events.ItemClickEvent;
public var mod2:ModuleLoader = new ModuleLoader();
public function onNavBarClicked(event:ItemClickEvent):void
{
trace("function executed");
var item:Object = event.item;
mod2.url = String(item.module);
mod2.loadModule();
mod2.percentWidth = 100;
mod2.percentHeight = 100;
mod2.addEventListener("ready", onReady);
}

public function onReady(event:ModuleEvent):void
{
panel.addChild(mod2.child);
}
]]>
</mx:Script>
<mx:Array id="arr">
<mx:Object label="Select Coverage"/>
<mx:Object
label="Life Insurance"
module="insurancemodules/LifeInsurance.swf"
/>
<mx:Object
label="Auto Insurance"
module="insurancemodules/AutoInsurance.swf"
/>
<mx:Object
label="Home Insurance"
module="insurancemodules/HomeInsurance.swf"
/>
</mx:Array>

<mx:LinkBar itemClick="onNavBarClicked(event)"
dataProvider="{arr}" />
<mx:Panel width="100%" height="100%" top="50" id="panel"
title="MainPanel"/>
</mx:Application>

Reply via email to