Today I was working on a project with real strange issues related to the duration of load operations. I decided to throw together a class that would enable me to throttle the download speed of the Loader class when used locally. Simply strangle the bandwidth by entering the desired speed in the load method and you’re good to go.
It works very much the same way as the Loader class with the only difference being that you add your event listeners directly to the SlowLoader instance instead of the contentLoaderInfo instance of the Loader instance. Other than that it dispatches the same events as the Loader class does so it should be fairly simple to swap it for a regular Loader when you’re done. I’ve also included and example class. Here’s an excerpt of it:
var l:SlowLoader = new SlowLoader();
l.addEventListener(ProgressEvent.PROGRESS, _updateProgress);
l.addEventListener(Event.INIT, _showImage);
l.load(new URLRequest("file.jpg"), 512, 0.9);
NOTE: SlowLoader was developed for my own use, which means that it dispatches AILoggerEvents for printing log messages from it. AILogger is also included in the ZIP file and you can read more about it here. If you do not wish to use it, feel free to strip these lines out of the class.