Difference Between Spyware & Adware Adding Web Search Information to Your Flash File, Making it SEO Friendly
Aug 07


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.

 
 

Share This Article: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
  • Technorati
  • Furl
  • Netscape
  • YahooMyWeb
  • BlinkList
  • DZone
  • Netvouz
  • NewsVine
  • Simpy
  • Slashdot

Leave a Reply