flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak MS <megharajdee...@gmail.com>
Subject ModuleLoader's loadModule() error
Date Thu, 19 Sep 2013 07:19:34 GMT
Hi there,

Can you kindly help me solve the runtime error I’m getting? I’m not able to
figure out why I get that error.



I have a Flex 3.6 application, which has a TabNavigator in main application:



<mx:TabNavigator id="tn"  width="100%" height="100%"
change="tn_changeHandler(event)" selectedIndex="{model.dashboardIndex}"


creationComplete="tn_creationCompleteHandler(event)">





                        <mx:Repeater id="screenRepeater"     dataProvider="{
screensXMLList}">

                              <mx:ModuleLoader  id="mdle"

                                                        url="{
screenRepeater.currentItem.@path}"

                                                        label="{
screenRepeater.currentItem.@label}"


loading="onModuleLoading(event)"



ready="onModuleReady(event)"


                                                        width="100%"
height="100%"  applicationDomain="{ApplicationDomain.currentDomain}"/>


                        </mx:Repeater>







</mx:TabNavigator>





Based on number of screens assigned to a user, it loads those many modules.
There is a module called ‘My reports’ which is the last module in the
tabnavigator. From there, based on some conditions I am trying to navigate
to other modules. There are dropdowns on top and charts and grids in each
of the modules. Basically the dropdown values get set here in ‘My reports’
module and since I want to reload the other modules to which I am
navigating, I am unloading and loading the respective module again, so that
selected dropdown values’ data in shown in charts and grids. This is my
pseudo  code in ‘My reports’ module, when I click a button:

//some code goes here to get parentIndex value which ranges from 0 to 4

model.dashboardIndex = parentIndex;

model.subDashboardIndex = i;

((*this*.parentApplication.tn.getChildren()[parentIndex])
*as*ModuleLoader).unloadModule();

((*this*.parentApplication.tn.getChildren()[parentIndex])
*as*ModuleLoader).loadModule();





In total I have 5(index range is 0 to 4) modules(in my test case). First I
open a report(from ‘My reports’ module) with model.dashboardIndex set to 3,
so it opens my 4th module correctly without any error. Now again I navigate
to ‘My reports’ and try to open another module by setting
model.dashboardIndex to 2. But in this case, after calling
((*this*.parentApplication.tn.getChildren()[parentIndex])
*as* ModuleLoader).loadModule();, I get this error:



RangeError: Error #2006: The supplied index is out of bounds.

      at flash.display::DisplayObjectContainer/getChildAt()

      at
mx.core::Container/getChildAt()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2367]

      at mx.containers::ViewStack/get
selectedChild()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\containers\ViewStack.as:549]

      at
mx.containers::ViewStack/commitSelectedIndex()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\containers\ViewStack.as:1063]

      at
mx.containers::ViewStack/commitProperties()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\containers\ViewStack.as:660]

      at
mx.containers::TabNavigator/commitProperties()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\containers\TabNavigator.as:504]

      at
mx.core::UIComponent/validateProperties()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5966]

      at
mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:539]

      at
mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:689]

      at Function/http://adobe.com/AS3/2006/builtin::apply()

      at
mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8892]

      at
mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8832]





I don’t know why I get index out of bounds error, as my tabnavigator always
has 5 modules in it and my tabnavigator’s index is set only between 0 and 4.



Any idea what’s going wrong here?



I felt that loading a module from another module might have caused this
error and hence I also tried to dispatch an event from ‘My reports’ module
to my main application where I have my tabnavigator and I tried to unload
and load the respective module there. Even that gave me the same error.







Warm regards,

Deepak

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message