• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Hour 20. Optimizing Your Flash Site > Task: See a Preloader in the Bandwidth Pr...

Task: See a Preloader in the Bandwidth Profiler

To get a sense of how the Bandwidth Profiler works, in this task you'll create a basic preloader to pause playback on the first frame until most of the movie is downloaded. Here are the steps:

Open the Keyframing sample file that you downloaded earlier (from www.phillipkerman.com/teachyourself/sourcefiles/keyframing.fla).

Select Insert, Scene. Open the Scene panel and rename the new scene Preloader. To rename it, just double-click the current name (Scene 2) and then drag the scene order so that Preloader is on top.

Click the first frame of the Preloader scene's Timeline and insert an extra keyframe (press F6).

Select the first keyframe, open the Actions panel, and insert an If statement (select the plus button and find “if” under Actions, Conditions/Loops). Then type _framesloaded>20 in the Condition parameter. With the first line of the If statement still selected, insert a Goto Action (under Actions, Movie Control) and type 3 in the Frame field. Translated, this means if more than 50 frames have loaded, the user will jump to and play frame 3 (where it will automatically go to the next scene and play).

So that the user can see it preloading, place some text onscreen. With the text selected use the Properties panel to set the text block as Dynamic Text and type _framesloaded into the Variable field. This way the user will see the value of this variable change while the movie downloads (see Figure 20.13). Make sure the Character Option dialog (accessed by the Character… button) is set to embed just numerals or the first frame itself (with all the font outlines) will take a long time to download.

Figure 20.13. While the first 20 frames download, the movie is paused on a frame displaying how many frames have downloaded.

Select frame 2 and insert another goto script (gotoAndPlay(1)).

Run Test Movie, and with the Bandwidth Profiler, select View, Show Streaming.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint