Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

10 Minutes with Flash: Creating a Loader Component for Flash Player 7

  • Print
  • + Share This
Don't like writing the same script more than once? In just 10 minutes, Robert Hoekman, Jr. will show you how to turn a pre-loader script into a reusable component.
From the author of

Awhile back, I wrote an installment of the "10 Minutes with Flash" series called "ActionScript You'll Never Have to Write Again" about writing a shell of a script and saving it for later use. I used a MovieClipLoader object for the example because it is something developers need frequently while developing for Flash Player 7. Today, we'll take the concept further by turning a modified version of the same script into a component that preloads external assets by incrementing a percentage value in a text field. That's right—it's a pre-loader. And once you build it, you'll never have to build it again.

The Movie Clip

First, we need a new file and a movie clip. (Components are really just movie clips that are compiled into self-contained .swc files.)

  1. Launch Flash MX 2004 or Flash Pro and save a new document as The_Loader.fla.

  2. Create a new Movie Clip symbol called The_Loader. (I just love it when things are totally obvious.)

To increment a percentage value in a text field, we need to add a text field to the movie clip.

  1. Activate the Text tool and choose Dynamic from the Text type menu in the Property inspector.

  2. Click on the Stage to create a dynamic text field. Drag the text field's handle to make it about two inches long.

  3. With the field still selected, enter message_txt into the instance name field of the Property inspector.

  4. Set the font for the text field to, let's say, 12 pt. Arial.

  5. Save your work, but leave the file open.

I've got about eight minutes left.

Now that we have the text field ready, we can start writing the script for the pre-loader. So far, your file should match Figure 1.

Figure 1Figure 1 The dawn of a new age...er...component.




  • + Share This
  • 🔖 Save To Your Account