views:

83

answers:

5

Hello,

Our Flash app has to load 50 or so files from a remote destination. Under normal network conditions, this is no problem. However some of our users started to report that the application "stopped working" during the loading phase.

After some tests where we decreased the network quality to a point where 1 out of 3 packets were dropped in bursts, we managed to reproduce the error reports. Looking at firebug, it appears as if a few of the files (1 to 3 out of the 50) begin loading but never complete. No errors are raised in ActionScript and there is no apparent pattern in which files fail to complete.

Has anybody run into situation before and found a cause and or fix to deal with these situations ?

It's not too hard to write something that manually verifies if loaders stop loading and restart the loading process, but I was wondering if we're simply not listening to the right error events (right now we listen to progress, complete, and IOErrors) or if there are other solutions ?

Cheers Mark

+1  A: 

How are you handling doing all of this loading? Are you just using Loaders (or subclasses of, like URLLoader) or are you using a library that will handle all of these for you?

Greensock's LoaderMax and BulkLoader are what I use when I have mass loading to do. I only recently started using LoaderMax over BulkLoader because of some nice features it has.

sberry2A
We're using Loaders and URLLoaders depending on the asset type. It's all coming from an inhouse library.Thanks for the suggestion, I'll have a look at the packages you mentioned.
Mark
A: 

One things you might want to take a look into is if you're making all of these requests all at once they loading might timeout and cause your files not to load. Servers often have limitations on how many concurrent requests it can serve up.

Therefore, it's good practice to manage your loading so that you load items one after another rather than start them all and wait until they all finish.

Henry
Maybe. However our server is not the bottleneck. Moreover, loading files one by one has been tried and lead to unacceptable load times. The current approach loads much, much faster load times, but gives problems for people with less optimal connections. Surely there must be a happy middle ground.
Mark
It's actually not a matter of your server being slow it's a matter of your server not allowing a large number of concurrent connections. While Flash waits for more connections to become available they are timing-out. A good example would be visiting a wallpaper download site and trying to download many wallpapers at the same time. Your downloads usually only run three at a time at most.
Henry
A: 

Have you checked that you are maintaining references to your loaders? If you are defining loaders as local variables with weak listeners there is the chance that they could be garbage collected before the loading process completes, and the failure will be silent.

danyal
A: 

Ok a long overdue follow up from a different account.

Thanks for all your suggestions. We've got a workaround which involves rescheduling loads when the server fails to respond in time or the client no longer receives bytes for X amount of time. At the worst this will mean users will have to wait a bit longer.

The cause of the requests silently failing is still a mystery though.

@Danyal - good suggestion, I suspect this isn't the case as our Loaders are managed, but I'll have to check to be 100% sure.

Mark
A: 

RxAs, while strictly speaking is not a loading library, has an example on Loading multiple XML documents and outputting a typed value which including handling errors and timeouts.

The code below loads an XML document and falls back to a static version after 10 seconds (though it could easily chain another XML load between the two):

Observable.xml(new URLRequest(xmlDocumentURL))
    .timeout(10000, Observable.returnValue(defaultProductCategories))
    .subscribe(function(xml : XML) : void
    {
        trace("Either way, we have an XML document");
    });
Richard Szalay