0 Replies Latest reply on Oct 10, 2007 6:36 AM by

    Module Application Problem

      Hi, I am new to Adobe Flex 2.

      I am stuck with a problem. Please help me out .

      # The problem is :- I have created 2 module (module01.mxml, module02.mxml) and a main application (index.mxml). Both modules have a button & a combobox. The main application have a three buttons. One removes module and other two loads respective modules.

      When I click combobox of one module and change to othere module and click the combobox of the other module the application gives error message and stops. This happens in cases of the buttons too which have a click event to show a message.

      @ I am herewith giving the code:-

      ----------- Main application file ( index.mxml ) -----------

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal">

      <mx:Script>
      <![CDATA[
      private function removeModule():void{
      currentModule.url = null;
      }
      private function loadModule(s:String):void{
      removeModule();
      currentModule.url = s;
      }
      ]]>
      </mx:Script>

      <mx:VBox height = "100%" verticalAlign="middle">
      <mx:Button label="Load Module 1" width="116" click="loadModule('module01.swf')"/>
      <mx:Button label="Load Module 2" width="116" click="loadModule('module02.swf')"/>
      <mx:Button label="Remove Module " width="116" click="removeModule();"/>
      </mx:VBox>
      <mx:ModuleLoader id="currentModule" height="100%" width="100%"
      horizontalAlign="center" verticalAlign="middle"/>

      </mx:Application>


      ------------------------------------------------------------

      ----------- First Module file ( index.mxml ) -----------

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:mx=" http://www.adobe.com/2006/mxml" percentWidth="100"
      percentHeight="100" backgroundColor="#ffffff"
      horizontalAlign="center" verticalAlign="middle">
      <mx:Button label="Module 01"
      click="mx.controls.Alert.show('Welcome to Module-01')"/>

      <mx:ComboBox >
      <mx:dataProvider>
      <mx:String>Job 01</mx:String>
      <mx:String>Job 02</mx:String>
      </mx:dataProvider>
      </mx:ComboBox>

      </mx:Module>

      ------------------------------------------------------------

      ----------- Second Module file ( index.mxml ) -----------

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:mx=" http://www.adobe.com/2006/mxml" percentWidth="100"
      percentHeight="100" backgroundColor="#000000"
      horizontalAlign="center" verticalAlign="middle">
      <mx:Button label="Module 02" color="#FFFFFF"
      click="mx.controls.Alert.show('Welcome to Module 02')"/>

      <mx:ComboBox>
      <mx:dataProvider>
      <mx:String>code 01</mx:String>
      <mx:String>code 02</mx:String>
      </mx:dataProvider>
      </mx:ComboBox>

      </mx:Module>

      ------------------------------------------------------------