Skip navigation
Currently Being Moderated

ModuleLoader loads modules randomly

Mar 27, 2013 2:09 AM

Tags: #module #moduleloader #random #spark #flex_4.6 #loads

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);    



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

  • Currently Being Moderated
    Mar 27, 2013 10:11 AM   in reply to LucasAlex

    ModuleLoader needs to have a parent.  Otherwise it may not start the load, and it will get randomly garbage collected.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points