Saturday, April 05, 2008

Flash Preloader

I've been wanting to learn to do this for a while. I needed a preloader for a Flash slideshow I made of some hi-res jpegs for my family because the swf file was about 7.6 MB. Anyway, this one is really good, simple. The actionscript actually makes sense to me:
myLoaded = Math.round(getBytesLoaded());
myTotal =
myPercent = myLoaded/myTotal;
_width = myPercent*150;
myText =
if (myLoaded == myTotal) {
else {

The only thing I changed is the command "gotoAndPlay," which in the original was "gotoAndStop." The preloader is on frames 1 and 2 and the slideshow starts on frame 3, so as soon as the loaded bytes = the total bytes (it's fully loaded) it goes to and plays frame 3. Then at the end of the slideshow I put the command gotoAndPlay(3) so it would loop the slideshow.

No comments :