Everyone is always trying to learn how to make a preloader. You can download them, but it's easiest when you can just make your own!
Simple PreloaderStart with 3 frames. Open up the actions for the 1st frame. Make a new variable called "loaded" and in it put "getBytesLoaded()". Make another variable called "total" and in it put "getByteTotal()". Now create an if action and in that put "loaded==total". This will check to see if the loaded bytes and total bytes are equal. Below the if action put "gotoAndStop(3);".
Your actions should look something like this:
loaded = getBytesLoaded();
total = getBytesTotal();
if (loaded==total) {
gotoAndStop(3);
}
In the 2nd frame actions put "gotoAndPlay(1);". You can put your play button on the 3rd frame!
Advanced preloader (do the above)
Make a rectangle which will be the loading bar. Select it and goto Insert/Convert to Symbol or for Flash MX 2004 Modify/Convert to Symbol or just press F8. Convert it into a movieclip (keep border outside of movieclip). Now select the new movieclip and goto it's actions. Start with an onClipEvent action and in it put "load". Create a variable called "sw" and in that put "_width". Now make another onClipEvent action and in it put "enterFrame". Under that make a variable called "_width" and in it put "sw*_root.loaded/_root.total". Goto the main timeline and make a dynamic text field called "p". Go back to the load bar actions and under the variable called "_width" make another variable called "_root.p" and in it put "int(100*_root.loaded/_root.total)+"%"".
Your actions should look something like this:
onClipEvent (load) {
sw = _width;
}
onClipEvent (enterFrame) {
_width = sw*_root.loaded/_root.total;
_root.p = int(100*_root.loaded/_root.total);
}
If you have any questions regarding this tutorial or any other question involving Flash you can email me at
sk8r831@yahoo.com and I will get back to you as soon as possible!