Now there aren't any pictures as of yet, but because its mainly code it shouldn't need them.
Bar Preloader
You've probably seen this one hundreds if not thousands of times, if you haven't you probably don't even know what Flash is and shouldn't really be reading this. This is quite simple - use the Rectangle tool to make a long bar. I suggest about 180 pixels wide by 15 pixels high. Place it well. Usually, they are in the centre (American: Center) of your stage. Position it how you like, though. Select it, press F8. Call it what you like, preferably something that make it obvious that it's a preloader. It needs to be a movie clip. Also, under Registration, the square is, by default, in the middle. Click on the square to the left of it, and then press OK or your Enter key. Now that's practically done. Click the newly created Movie Clip if it's not selected already and press F9. In it, enter this:
Congratulations. Now I know it's hard to test it out, but I assure you, it works.
onClipEvent(load) {
var Percentage;
var BytesLoaded;
var BytesTotal;
}
onClipEvent(enterFrame) {
BytesLoaded = getBytesLoaded();
BytesTotal = getBytesTotal();
Percentage = BytesTotal/BytesLoaded*100;
_xscale = Percentage;
}
Here's the stuff you should know:
getBytesLoaded(); - This gets the amount of bytes that have been loaded.
getBytesTotal(); - This gets the total amount of bytes to be loaded.
_xscale - This is the variable which treats size as a percentage.
onClipEvent() { } = (load) - When the movie clip with this code applied to is loaded, these actions are performed. (enterFrame) - Every frame of the movie these actions are performed. This is not the kind of frames in your timeline. If your frame-rate is 30 fps, then it performs these actions 30 times a second.
Informative Preloader
I'll teach you how to make a Percentage and Bytes Loaded/Bytes Total
preloader. Create two text boxes. Position them well. Give one an instance name of Bytes, and another of Percentage. And now for the code. Just put this on the first frame:
Lets say I have a Flash of 1KB - That's 1024 bytes. When fully loaded,
var BytesLoaded = getBytesLoaded();
var BytesTotal = getBytesTotal();
var Percentage = BytesTotal/BytesLoaded*100+"%";
Percentage.text = Percentage;
Bytes.text = BytesLoaded+"/"+BytesTotal;
the outputs (the text boxes) should look like this:
Bytes = 1024/1024
Percentage = 100%
Frame-By-Frame Preloader
This one can do pretty much anything you like as it loads. Create a new Movie Clip (name and registration don't matter) and inside it create 100 frames. On each frame draw what you want it to do. Each frame is 1%. When you're done, go on to the stage and put your preloader there, if it isn't there already. Click on it and press F9. Inside, type:
onClipEvent(load) {
var BytesLoaded;
var BytesTotal;
var Percentage;
}
onClipEvent(enterFrame) {
BytesLoaded = getBytesLoaded();
BytesTotal = getBytesTotal();
Percentage = BytesTotal/BytesLoaded*100;
gotoAndStop(Percentage);
}
Now it'll go to the frame correpsonding to the percentage. For example, it would go to frame 100 at 100%.
EDIT This is important! Don't forget to put:
if(Percentage == 100) {
_root.play();
}
In your enterFrame events!
EDIT Important for the Imformative Preloader! The text boxes have to be big enough of course, so make the Percentage textbox big enough for 4 characters and the Bytes textbox as big as possible. By 'big' I mean wide, and don't use the transform tool, use the square/circle found in the top right of the textbox when you select it.