If you’re very ambitious and create a huge Flash file, downloading it to a viewer’s browser might take a long time. Your audience won’t wait forever. To solve this problem, you can create a preloader, which is a tiny movie that loads quickly and tells your viewers to wait. Often, it simply says loading, followed by a percentage loaded.
Flash 8 comes with a Loader component and a ProgressBar component that you can use to build preloaders, but they require more lines of fancy ActionScript code than you may want to deal with if you’re new to Flash. For now, you might want to start out with a simple preloader using a few lines of more oldfashioned ActionScript code, which you can create by following these steps:
1. Create two scenes — the second for your main movie and the first for the preloader. Or if your movie already has multiple scenes, add another scene for the preloader and make it the first scene.
The scenes must be within the same movie.
2. In the first scene (the preloader), create whatever you want your audience to see while the rest of your movie loads. Keep this scene simple so that it loads quickly.
3. Click the first frame of your preloader scene. Then choose Window➪ Actions to open the Actions panel if it isn’t already open, and if necessary, click the collapse arrow on the title bar to expand it. In the Actions panel, click the Script Assist button to deselect it (if it’s selected).
4. In the Script pane on the right side of the Actions panel, type in the following ActionScript code:
if (_root._framesloaded >= _root._totalframes) {
gotoAndPlay(“Scene 2”,1);
}
The ActionScript specifies that if the number of frames loaded is greater than or equal to the total number of frames in your movie (in other words, if the last frame of the main movie is loaded), the playhead of the Timeline should go to the first frame of the scene named Scene 2 and play it.
5. Click the last frame of your preloader scene.
6. From the list of action types on the left side of the Actions panel, click the Global Functions category and then the Timeline Control subcategory; then double-click the gotoAndPlay action.
gotoAndPlay(); appears in the Script pane on the right side of the Actions panel.
7. Type 1 in the Script pane.
Now your code should look like this:
gotoAndPlay(1);
This ActionScript loops your preloader so that it plays over and over until your main movie is loaded.
Tip
You can test your preloader by choosing Control➪Test Movie, but your main movie might load so quickly that you don’t even see the preloader. Choose View➪Simulate Download to see how your preloader works while your main movie loads. You can also upload your file to a test page on your Web site to see how the preloader works. Make sure that your preloader is long enough for the human eye to see. Remember that one frame.is displayed for only a fraction of a second.













May 18th, 2009 at 4:01 pm
Hey
I am going out of my mind and need some expert advice….any sollutions as to why my preloader does not work in my Flash Presentation….any answers would be so much appreciated.
Thanks for taking the time to read this!
May 18th, 2009 at 4:08 pm
Are you using browser to view your Flash file? Have you tried different browsers?
May 18th, 2009 at 4:13 pm
Hi
Yes, the staus of the preloader doesn’t appear, its as if the SWF doesnt have a preloader in it. I have done a bit of research and it does seem to be a common problem with flash presentation files and not just with v8 but I cant seem to find a sollution.
June 8th, 2009 at 4:48 am
So this means that I can have as many preloaders as I want to load as many scenes right? What if I have everything in one scene and I want to have a preloader load certain parts of my timeline other than leading me to a scene? How would I do that?