1 Reply Latest reply on Mar 27, 2013 10:11 AM by Flex harUI

    ModuleLoader loads modules randomly

    LucasAlex Level 1

      Good day.

      I'm writing an application that loads modules at start.

      These modules are s:Module objects.

      I'm using the s:ModuleLoader to load these modules, as i was getting errors trying to load these files with a simple Loader/URLLoader.

      Here's how i load them :

       

      var moduleLoader:ModuleLoader = new ModuleLoader();    

      moduleLoader.addEventListener(ModuleEvent.READY, onLoadComplete);    

      moduleLoader.addEventListener(ModuleEvent.ERROR, onLoadError);    

      moduleLoader.addEventListener("progress", checkProgress);    

      moduleLoader.loadModule(url);  

       

      Where url is the correct URL to a module, nothing wrong here. Basically i have this in a queue, and as soon as a module is loaded, i load the next one on the list.

      The problem is that everytime i execute the code, i have a random number of modules loaded.

      When a module is not loaded, no ModuleEvent.READY is dispatched, but the module is fully loaded, because when i check the "progress" handler, the last tick shows me 48683/48683 loaded (for instance), so the module is loaded but no event is dispatched that would tell me that loading is complete.

      I don't get any errors / warnings.

      I really don't understand why it is so random.

      Switching modules' places in the queue still makes them load randomly, so no effect.

      Tried to exclude modules from the list - still random.

      Sometimes modules won't load at all.

       

      During these executions i don't make any changes to my code at all.

      Please help me, or tell me how i can load modules otherwise, not using this ModuleLoader.

      Using Flex 4.6