4 Replies Latest reply on Mar 30, 2008 5:04 PM by riesvantwisk

    ModuleLoader Acting Completely Flaky

    slaingod Level 1
      I'm having some issues with loading multiple modules simultaneously. My app has:
      <mx:Canvas id="views_canvas" x="10">
      <views:Home id="home" visible="false"/>
      <views:SubmissionStub id="submission" visible="false" />
      <views:ListStub id="list" visible="false" />
      <views:PrizesStub id="prizes" visible="false" />
      </mx:Canvas>
      where the stubs are wrapper components for my ModuleLoaders, so I can catch events, etc. for my Modules beffore they are loaded.

      The inside of a stub looks like:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:ModuleLoader id="module" url="{'views/PrizesModule.swf?uid=' + new Date().getTime()}" />
      </mx:Canvas>

      (The url is set to prevent caching, but doesn't work if url="views/PrizesModule.swf" either.)

      I have 3+ of these things that load as soon as my app initializes. As soon as I allow the 3rd to try and load, all heck breaks loose, and only occasionally does it work. Any 2 of the modules will load together, but not when you have 3 or more.

      In the past I've found Flex's event model to be unreliable, losing events when under load. This was when loading 1000+ images from a zip file, and waiting on their Loader events to complete (ala the FZip example, but where the images' bitmap data is processed, not added to controls).

      Any thoughts on why this might not be working? I can have my show event in the stub component set the URL, but that adds in delays when switching to the hidden modules. Thanks.
        • 1. Re: ModuleLoader Acting Completely Flaky
          riesvantwisk Level 1
          My first thought would be that the browser prevents the number of simultaneous downloads Some browsers only allow 2 open sockets to one domain, other browsers allow more. I do use ModuleLoaders as-well, but then programatically... I basically execute one load at a time and even if I request 4 or more modules, they all get loaded.

          Could you setup something like this aswell?? Should be fairly easy to try i think. I also noticed that the caching only works once, so upon subsequent calls it will use the cached SWF file and will not instruct to really load a new version, however this was checked with quick testing only.

          Ries
          • 2. Re: ModuleLoader Acting Completely Flaky
            slaingod Level 1
            That could be it. Seems like something that should be transparent to the end user (me) tho. Unless you are using ViewStack, etc., this is like the simplest usage of modules, and yet it breaks without an error message or anything.
            • 3. Re: ModuleLoader Acting Completely Flaky
              levancho Level 3
              I confirm that as well, even more, sometimes READY event does not fire at all, even thought there is module load called . for at least one module (currently I am talking about 6 modules ) .

              quote :---- Some browsers only allow 2 open sockets to one domain -----

              that worries me a little, is there any specification that says about this? or its just up to the browser wendor's PM mood?
              • 4. Re: ModuleLoader Acting Completely Flaky
                riesvantwisk Level 1
                It's vendors browsers mood... :D

                Read here a bit more about it : http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/

                It's also that reason why you cannot upload let's say 4 files at a time, but they are scheduled after each other.

                As you might have noticed is that google and yahoo maps send images from different services, not only to balance and offload there server, but also to make sure more then 2 parallel sessions are openend to service you the images as fast and simultaneously as possible.

                I think in feature the limit will be reased to 4-6 connection, but properly not to high as well because on the server you need much more resources...

                Ries