Log
View Options
AS3 Preloader Class
3/17/09

Ok, so who is tired of making a preloader for every mid to large size project? Yes it is essential to have something pretty for people to look at while they are waiting for your page or other info to load. But wouldn't it be nice if setting up a preloader was only a couple lines of code? YES!
Soooo, I have made a rather slick preloader class will track anything you tell it to (well so far only The Stage, MovieClips, Loaders, and Sound), just by calling
Preloader.trackLoading(your_obj);
.
All the public functions are static, so they can be access directly by the class name + function name. The super nice part is you can call Preloader.trackLoading(stage); on the your stage and let the preloader do all the work, so anytime you loaded a moive onto your stage the preloader knows and will kick on and do it's thing.
Sound is a little different, I am still trying to capture where in the event phase a sound starts loading, so for now anytime you load a sound via script you would have to tell the preloader to track it manually like, Preloader.trackLoading(ur_sound);.
So, you probably are wondering how simply tracking the data will lead to your own custom pretty loader. There are two stored functions by the preloader class, onLoaded and whileLoading and these are read/write. Well, anyways, if your really interested go ahead and download the class and it's example files.