Previous Page
Next Page

Tripod >> 3pod Tips & Learning and manuals for educations

Recipe 20.5. Creating Preloaders for Files with Exported Symbols

Problem

Your have a file that exports movie clips for ActionScript, and you want to add a preloader.

Solution

Use the same preloader principles discussed earlier in this chapter. In addition, uncheck the "Export in first frame" option for each exported movie clip within the library.

Discussion

As you learned in Recipe 11.17, you can tell Flash to export a movie clip symbol even if it is not used at authoring time. That enables you to programmatically add instances of the movie clip using ActionScript. With a few simple movie clips exported for ActionScript, you won't likely notice any effect on the preloader. However, with many complex (particularly bitmap) movie clips that are exported for ActionScript, you may start to notice that the preloader doesn't appear immediately. It's possible that the preloader may not even appear until most of the file has downloaded. This is due to the default setting for movie clips exported for ActionScriptthey are set to export on the first frame. Thus every exported movie clip must download before Flash will play back even the first frame.

There is a relatively simple solution, however. Although the default setting is such that Flash-exported movie clips are exported on the first frame, you can tell Flash to use an alternate frame instead, with the following steps:

  1. Uncheck the "Export in first frame" option for each movie clip symbol. You can access the option from the Linkage properties dialog box. By default, the "Export in first frame" option is checked when you check the "Export for ActionScript" option. However, when the "Export for ActionScript" option is selected, you can independently toggle the state of the "Export in first frame" option.

  2. Place instances of the movie clips on the stage at authoring time. That way Flash knows what frame to use in order to export the symbol.

The second step may seem counterintuitive. However, it is simply the way in which you communicate to Flash where to export the symbol. The dilemma that arises is then that you frequently don't want those symbols to appear in the exported movie on any frame unless they were placed there with code. So placing an instance on the stage at authoring time seemingly defeats the purpose, or at least causes an obstacle. The solution is to approach the Flash project in a somewhat nonlinear fashion. Even though a timeline plays from first frame to last frame by default, there's no reason it has to do that. As you've already learned, you can use simple ActionScript commands to tell Flash to stop, play, and jump to any frame within a timeline. Therefore, you can always place the movie clip instances on a frame that is never played. For example, you can place the preloader on frame 1, the movie clip symbol instances on frame 2, and then the actual content starting on frame 3. Within the script on frame 1, you can instruct Flash to jump to frame 3 once the file has downloaded.

Tripod >> 3pod Botom Tips & Learning and manuals for educations

Previous Page
Next Page

 

bluedot bluedots greydots pinkdots

Tripod >> 3pod Tips & Learning and manuals for educations