thomas stanley / staticmethods

  • Home
  • About

AS2 SequentialLoader Class:

Published by tom on January 29, 2008 12:20 am under ActionScript 2

A long while back, i needed to write a class that could be used to load a series of swfs or images in sequence, and monitor the progress of each item in the sequence or the sequence as a whole. SequentialLoader is what i came up with, and it has come in handy every once and a while since. Essentially, the instance is created by passing in an array of assets (images or swfs) and an array of holder MCs to load the assets into. Once instantiated, startLoad can be called on the SequentialLoader instance, and the instance will broadcast events to anything that has registered as a listener.

Now that i'm thinking about making it publicly available, i've decided to go back and clean it up a bit. It should be done in a day or two, and when it's ready, i'll post the code, and an example for download. Check back for updates to this post...

Here's a really simple example of how the class is used:

PLAIN TEXT
Actionscript:
  1. import com.staticmethods.loader.SequentialLoader;
  2.  
  3. var assets:Array = new Array("one.jpg", "two.jpg", "three.jpg");
  4. var holders:Array = new Array(holder1_mc, holder2_mc, holder3_mc);
  5.  
  6. var sl:SequentialLoader = new SequentialLoader(assets, holders);
  7. sl.addEventListener(SequentialLoader.EVENT_SEQUENCE_COMPLETE, this.handleSequenceComplete);
  8. sl.start();
  9.  
  10. function handleSequenceComplete($eventObj:Object):Void
  11. {
  12. trace("Everything is loaded!");
  13. }

No Comment

Comments are closed.

Posting your comment.

  • Search

  • Archives

    • January 2008 (2)
  • Categories

    • Uncategorized (1)
    • ActionScript 2 (1)
  • Pages

    • About

Copyright © 2012 thomas stanley / staticmethods
WordPress Theme based on Light Theme