6 Replies Latest reply on Feb 5, 2007 4:11 AM by mcmcmark

    Module Loader prgress

    mcmcmark
      Hello. We are building a large app and have decided to use modules. I currently have a small Main app that is basically just a login form. IF the user successfully logs in it changes states to a state that has a big module loader on it. It then loads in the appropriate module for the user. This is all working fine except I can not figure out how to get the module loader progress to appear?? I have tried following the help docs but still can not get it working. I am looking for any advise. I am only concerned with a progress bar at this point, so hoping to be able to write a single function to track and somehow display back to the loader.
        • 1. Re: Module Loader prgress
          peterent Level 2
          The <mx:ModuleLoader> has progress and ready events. Suppose the ModuleLoader is in a Panel called modulePanel. A Panel has a status field in the upper-right corner in its title area. You could show progress like this:

          <mx:ModuleLoader progress="modulePanel.status=event.bytesLoaded+' of '+event.bytesTotal"
          ready="modulePanel.status='Ready'" ... />

          To show a progress bar, set up to work manually and use its setProgress method:

          <mx:ProgressBar id="moduleProgress" mode="manual" ... />

          <mx:ModuleLoader progress="moduleProgress.visible=true; moduleProgress.setProgress(event.bytesLoaded,event.bytesTotal)"
          ready="moduleProgress.visible=false" ... />

          Is this what you had in mind?
          • 2. Re: Module Loader prgress
            mcmcmark Level 1
            Thanks. I am getting some errors with that. My Moduleloader is on its own, inside a blank state. It looks like this:

            <mx:AddChild position="lastChild">
            <mx:ModuleLoader id="modloader" styleName="noPad" width="100%" height="100%" url="{defaultApp}" x="0" >
            </mx:ModuleLoader>
            </mx:AddChild>
            </mx:State>

            • 3. Re: Module Loader prgress
              peterent Level 2
              And you are getting errors (compile errors? runtime errors?) when?

              Did you try adding the progress and ready event listeners to the <mx:ModuleLoader> in the state?
              • 4. Re: Module Loader prgress
                mcmcmark Level 1
                Thius is the error I am getting:

                Component may not have both a text initializer and attributes.

                Here is what I tried:

                <mx:ModuleLoader styleName="noPad" width="100%" height="100%" url="{defaultApp}" x="0" >
                progress="LoadApp.status=event.bytesLoaded+' of '+event.bytesTotal"
                ready="LoadApp.status='Ready'"... </mx:ModuleLoader>

                Thanks, I really appreciate you trying to help. I am obviously new at this :)
                • 5. Re: Module Loader prgress
                  peterent Level 2
                  You have a syntax error: remove the > after x="0" because the progress and ready attributes are part of the ModuleLoader tag.

                  I assume you aren't putting in the ... ? That was just to indicate any other stuff you are using.
                  • 6. Re: Module Loader prgress
                    mcmcmark Level 1
                    Peter,

                    Thank you so much, I was finally able to get it working this morning. I really appreciate the help. I needed to add a child for the progress bar on in the state and then it worked. Thanks again.