1 Reply Latest reply on Jun 25, 2009 6:02 AM by leybniz

    Regarding Loding & Reloading modules

    Ashish Mishra Level 1

      Hi All,

      I have a question regarding modules:

      Let me first put the scenario: I my application, there is a MenuBar.
      It contain lot of options like

      Project, Modules, Designers, Coders, Contributers and Testers (each
      option contains 2-3 sub menues like create, edit, search etc) .

      The problem was the size of application was around 2 MB and it was
      taking lot of time to load(around 23 secs, including 2 server calls
      using remote object). So, I thought to break the application in
      Modules, So, Initially I loaded only projects. But Contributers,
      Testers and Designers are loaded when user click on the corresponding

      Now, currently, on each click I am loading the modules, with following


      private function loadStackModule():void {

              info = ModuleManager.getModule("contributorModule.swf");


      private function loadContributorEventHandler(e:ModuleEvent):void {
               stackModule = info.factory.create() as DisplayObject;
               vbxStacks.addChild(stackModule as DisplayObject);
               vsMainContainer.selectedChild = vbxStacks;


      This is how, I am loading the module every time user click on the
      corresponding modules. So I have following Questions:

      1. Do I need to load the module every time, when user click on the
      2. Or I need to load it only once, later I can utilize the same
      module, how to track that module is already loaded, may be with some
      boolean flag.
      3. I also want to know whether size of an swf with 2 MB is fine or I
      should use Modules.

      4. Also, If I need to access the variables of Modules from the child
      comonent, how can I access it ?
          in module, there two component CreatePrj and SearchPrj which extend
      title window. Module has instance of both. Now, i need to access a
      variable of CreatePrj in SearchPrj, how can I access it?
      Also, I need to access a var say someId in Module, how will I refer
      that from CreatePrj?

      Thanks for your efforts to find the answer for the questions