0 Replies Latest reply on May 6, 2008 12:43 AM by paulhergh

    loading a module in parrentApplication from another module

    paulhergh
      Hi,

      I have the following parrent application:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" backgroundColor="0xE6E6E6" themeColor="0x0000B0">
      <mx:Style source="layouts/oxygen/style.css"/>
      <mx:ModuleLoader url="mxml\menu\menu.swf" id="moduleTop" width="100%"/>
      <mx:ModuleLoader id="moduleBottom"/>
      </mx:Application>

      In menu.swf i have the following code in the initApp() that is called at the creationComplete event from the menu module:
      private function initApp():void
      {
      var urlModule:String ="mxml/"+"start"+"/"+"start"+".swf";
      createModule(parentApplication.moduleBottom, urlModule);
      }

      mxml/start.swf :

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" width="100%" height="100%">

      <mx:Style>
      Module {
      padding-bottom: 5px;
      padding-left: 5px;
      padding-right: 5px;
      padding-top: 5px;
      }
      </mx:Style>
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;

      public function initDayArray():void {
      var dayArray:Array=new Array();
      var day:Number;
      for (day=0;day<31;day++) {
      dayArray[day]=String(day+1);
      }
      dayArray.unshift("");
      S_PER_DTENAISJOUR.dataProvider=dayArray;
      }
      ]]>
      </mx:Script>
      <mx:ComboBox styleName="ComboBox" id="S_PER_DTENAISJOUR" text="" initialize="initDayArray();"/>
      <mx:HRule width="100%" />

      </mx:Module>


      Now comes the big problem I'm having:
      -If this module is loaded in the parrentApplication in the same manner the menu.swf is loaded, the comboBox data will appear, with the drop down selection possibility
      <mx:ModuleLoader url="mxml/start.swf " id="moduleBottom" width="100%"/>

      -But I need the source for this moduleBottom to change according to the the current menu tab pressed, so I have to load somehow dinamically the swf's but I'm having this problem with comboboxes, I can't select data from them.


      So if I load the start.swf directly in the parrentApplication mxml file, it works, but if I try to load it from an module allready loaded, it doesn't work.
      The same thing happens also with alerts, in the first case they will appear, but in the second I can't manage to make them work.

      Any help would be appriciated...
      Tnx