Workshop

 < Day Day Up > 

The Workshop consists of quiz questions and answers to help you solidify your understanding of the material covered in this hour. You should try to answer the questions before checking the answers.

Quiz

1:

How many movies can you load into a single clip instance?

  1. None. You need to use two clips.

  2. As many as you want.

  3. One at a time

2:

If you're having trouble playing an external .wav sound file at runtime, what's the likely cause?

  1. Your speakers are not cranked.

  2. You can only play .mp3 files.

  3. You have to use Publish Preview in the browser in order for sounds to play.

3:

How many people can simultaneously edit the master version of a shared item?

  1. One

  2. As many people as you want

  3. A number equal to how many user files you have

Quiz Answers

A1:

C. You can have only one loaded movie per clip (or level, for that matter).

A2:

B. Flash only supports the runtime import of sounds in .mp3 format and images in .jpg format.

A3:

A. Only one person can actually edit the master version of shared items. After the master version is turned into a .swf, you can share it throughout a network or just redistribute copies to everyone involved.

Exercise

Back in the task "Use the MovieClipLoader Object to Display Progress," you displayed a progress bar by scaling from 0% to 100%. Instead, for this exercise, consider making a movie clip containing an animation. For example, you could do a shape tween or frame-by-frame animation of a glass filling up or a sand-timer emptying. The code really isn't too difficult. Instead of taking the percentage downloaded and setting the _xscale, you just do a gotoAndStop(). Imagine if the movie clip you create has 100 frames; you could simply jump to the frame that matches the percentage. In fact, you can jump only to whole number frames when using gotoAndStop(). The following code takes care of that. What's cool about this code is that your movie clip need not be exactly 100 frames.

So, make a movie clip with the multiple frame animation you want and put an instance on stage with the instance name progress_mc. Then, replace line 7 of step 7 of the task "Use the MovieClipLoader Object to Display Progress" with the following code:

 progress_mc.gotoAndStop( Math.floor((bytesLoaded/bytesTotal) * progress_mc._totalframes )); 

     < Day Day Up > 


    Sams Teach Yourself Macromedia Flash 8 in 24 Hours
    Sams Teach Yourself Macromedia Flash 8 in 24 Hours
    ISBN: 0672327546
    EAN: 2147483647
    Year: 2006
    Pages: 235

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net