Simple Flash Preloader
Creating a Very simple Flash Preloader
Whats a flash preloader?
A flash preloader is something that actually loads the whole file.
Its very useful for people who are waiting to go into your site.
What software are you using?
I am using Macromedia Flash Professional 8. If you have Flash Mx 2004 you can use that too.
I am going to create a very simple preloader which says "Loading..."
1). Create a new document in Flash.
Well you should know how to do that so I am going to be lazy and provide no images for this step (:o)
2). Now create a key frame on the second frame of your layer.
This key frame is where we will put all our main content.
3). Go back to your first frame and then select the text tool.
Using the text tool make some text and put some text into it like i did...
4). Okay now open up the actions panel (should be near the bottom of flash pro 8)...
Then copy and paste the following code into it...
Code
stop(); //MAKES THE FRAME NOT GO TO THE NEXT FRAME
this.onEnterFrame = function() { //WHEN ENTERING THE FRAME
percent = int(getBytesLoaded()/getBytesTotal()*100)+"%"; //GET PERCENT LOADED
if (getBytesLoaded() == getBytesTotal()) { //IF NUMBER OF BYTES LOADED IS EQUAL TO BYTES OF THE FLASH FILE
delete this.onEnterFrame; //DELETE THIS FRAME
nextFrame(); //GO TO THE NEXT FRAME
} //END STATEMENT
} //END ON ENTER FRAME
5). Now go to your second frame and open up the actions panel again...
Then copy and paste this bit of code into the second frame actions panel...
Code
stop(); //STOPS ITS FROM GOING BACK TO THE FIRST FRAME
Now put something big or humungous on your second frames canvas.
I put a picture of RMB =D ...
Okay you have succesfully created your flash preloader!
Flash preloaders can be used for making games, websites, banners and all sorts of stuff.
But my preloader does not work! It goes to the second frame straight away!
Well thats because the flash file is on your computer and your computer loads the data instantly because it just needs to load it from your hard drive.
So what do you need to do to test it?
Well, first test your movie...
You should get a window with the contents of your second frame. Heres mine...
Now click on
View and then on the drop down menu select
Simulate Download
This should show your preloader in action loading the thing. Mine took about 20 seconds to load so be patient!
In the next preloader tutorial I will show you how to create an even better preloader with stuff like percentages etc.
I havn't been bothered to post an example sorry but I will if requested.
Fla Download Url:
http://www.ragingmortals.com/tutorials/tutorial_03.fla
If you want to report any bugs please use the comments although i have tested this with my own flash player.
Thanks,