My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

ActionScript3 PreLoader Class with queue

We (Philipp and me) have been using the PreLoader class as a Loader replacement for years now to load asset content (swfs and images). The PreLoader has an integrated loader queue which allows one loading process at a time. It also has some convenient features like smoothing images when scaling them down.

The PreLoader class is not a visual preloader! You as a developer still have to do the dirty work like listening for progress and complete events and react to them. However, you can concentrate on that work without all the (from our point) useless overhead like contentLoaderInfo and URLRequest.

Example implementation:

var img:PreLoader = new PreLoader();
img.addEventListener(ProgressEvent.PROGRESS, _onImgProgress);
img.addEventListener(Event.COMPLETE, _onImgLoaded);
img.load("image1.jpg");
addChild(img);

function _onImgProgress(event : ProgressEvent)
{
  var perc:Number = event.bytesLoaded / event.bytesTotal;
  trace(perc);
}

function _onImgLoaded(event : Event)
{
  trace("image loaded");
}

Difference to Loader

Here you find the DifferenceToLoader.

Example scenario

Here you find a TypicalScenario.

Code documentation

You can find the API documentation here.

What the PreLoader can do for you:

  • Having a super easy loading queue that enables you to always fill the bandwidth of the user
  • Change the queue during runtime by calling loadNext(), loadAfter() and loadImmediately()
  • Work with the PreLoader just like with the well known Loader - only with some small but time saving improvements

What the PreLoader will not do for you:

  • Group load requests (the PreLoader only has one pipe)
  • Displaying visual loading informations (the PreLoader fires the effect, you decide what to with them)
  • Loading data (PreLoader loads only swf's and images)

Contribute

We have been working a lot with the PreLoader class. It can be called "well tested". However, if you find an issue or miss a feature, please let us know.

Powered by Google Project Hosting