Creating a Size Report


Creating a Size Report

Another useful troubleshooting feature built into Flash is the Size Report. (See Figure 5.14.) The Size Report is a text file that lists the size (in bytes) of every frame and every element in your Flash file. The report is broken up into different sections:

  • Movie Report. This tells you how much information has to download for each individual frame.

  • Page. This gives the size of all items on the stage that are not symbols. Text, grouped items, and drawn graphics are listed here.

  • Symbol. This lists the name and the size of each symbol, as well as the size of any text used in the symbol, for your movie.

  • Bitmap. This lists the imported bitmapped images. This section is particularly useful because it shows the uncompressed size, along with the compressed size for each element. Thus, you can get a quick visual check of how compressed each element is.

  • Sound. This lists all the sounds, their sizes, and the compression ratios.

  • Font. This lists all the fonts that you use in your movie. Notice that Flash imports only the characters actually used in your movie.

Figure 5.14. The Size Report gives you additional information that is not available by using just the Bandwidth Profiler. You can see the information that needs to be downloaded for each frame and for each movie element.

graphics/05fig14.gif

In Exercise 5.5, you create a Size Report that you can use in conjunction with the Bandwidth Profiler to help you optimize your movie.

Exercise 5.5 Creating a Size Report for Your File

The Size Report gives you additional information that you can use when you are trying to optimize your movie.

  1. If you don't have the magnatec.fla file open, open it now.

  2. Choose File > Publish Settings. Select the Flash tab and under Options, choose Generate Size Report.

  3. If you click Publish now, the Size Report is created in the same directory as the magnatec.fla file. The Size Report also is generated every time you test your movie.

  4. Browse to the directory where the magnatec.fla file is located and find the text file named Magnatec Report. Open the file in your text editor of choice.

A quick look at the Size Report confirms what you already know from using the Bandwidth Profilerframe 1 is a problem. You could set up a preloader to enable all the information in the file to download before playing. A preloader, which you learn about in detail in Chapter 16, "Using Preloading Sequences," just pauses the movie until the assets that you specify have downloaded. Before you decide you need to use a preloader, however, take some time to explore your other options. In the next exercise, use the information you have available to you from the Bandwidth Profiler, the Size Report, and the Movie Explorer to optimize your file.

Using the Diagnostic Tools to Pinpoint Problems

You already know that frame 1 is a problem. Take a look at what is currently being loaded in that frame by opening the Movie Explorer and filtering for Frames , Layers , Movie Clips, Graphics, and Bitmaps. You'll find that the following information is loaded in frame 1:

  • Nav Bar MC. This contains the navigational elements, including these movie clips: innovationMC, technologyMC, and performanceMC.

  • StaticMC. This contains all the moving lines and flashes that overlay the street scene.

  • Frame. This contains the upper and lower horizontal graphics that frame the street scene.

  • NewWorldTransMC. This contains the semi-transparent words that move over the street scene.

  • Next Button. This contains the tweened button that appears above the upper part of the frame.

  • Streetscene.jpg. This contains the background street scene.

Now you see why you need to use the Bandwidth Profiler, Size Report, and Movie Explorer together to make sense of the situation. The Nav Bar MC shows up in the Size Report as having 41 shape bytes and 542 text bytes. However, the innovationMC inside the Nav Bar MC has 52 shape bytes, and the Innovation text graphic inside that has 1148 text bytes. It gets frustrating real fast.

In the Movie Explorer, completely expand the node for the Nav Bar MC. You'll notice that you can find the innovationMC movie clip there, but not all the information embedded in the innovationMC movie clip. To find that, you have to drill down through the Symbol Definitions. After you have a list of all the elements in the original movie clip, you can use the Size Report to determine how much information has to be downloaded for that movie clipor you can cheat. For the lazy person's approach to this problem, follow Exercise 5.6.

Exercise 5.6 Using the Information from Bandwidth Profiler and Size Report to Pinpoint Problems

Although the Size Report and Movie Explorer help you pin down the general problem areas, try using the Bandwidth Profiler to help make this information more meaningful.

  1. Open magnatec.fla if it isn't already open.

  2. Try staggering the introduction of the content in each layer. In other words, leave the keyframe on the Border layer in frame 1, but drag the keyframe from the first frame of the Logo layer to frame 2.

  3. Continue staggering the introduction of the first frame of the layers as follows :

Next Button:

move to frame 3

Nav Bar:

move to frame 4

StaticMC:

move to frame 5

GraphicMC:

move to frame 6

Mask:

move to frame 7

NewWorldTransMC:

move to frame 8

Streetscene

move to frame 9

  1. Test your movie and switch the view for the Bandwidth Profiler to Frame-by-Frame Graph. Now you can see exactly where the worst of the problems are.

The first major hit is in frame 4that's where you introduce the Nav Bar movie clip. If you check the Size Report now, you'll see that in that one frame you are introducing 98306 bytes of information.

If you open the Nav Bar movie clip, you'll see that the problem is that you have not only the navigational bar and buttons in this movie clip, but also the movie clips with information that is presented whenever you press a button.

You have a couple options for approaching this. You can move the movie clips that are currently embedded in the Nav Bar movie clip to the main timeline. Alternately, you can have each movie clip be an independent movie that is loaded only as needed using the LoadMovie function.

By moving that information into separate movies, you not only help optimize your file, but also you get the benefit of reducing the download time for the file.

The next significant problem is in frame 9 where the streetscene.jpg resides. Because this is a bitmap, you're going to take a penalty for file size, but you can minimize it as much as possible. Try changing the compression for the bitmap, and see how much file size you can save. Remember: Test early, test often.

To see how else you can optimize your file, from rearranging frames and layers to splitting some of the other movie clips into separate movies, examine magnatec_final.fla in the Chapter_05/assets folder. If you're interested in how you can set up a preloader, you can jump ahead to Chapter 16 for more information.

If you decide to break your FLA file into several movies, you'll have to dive into ActionScript to load those movies as they're needed. It's not at all difficult to do.

Breaking a Large Movie into Several Smaller Ones

Obviously, you'd prefer to plan ahead and know you were going to want to have several smaller movies rather than one really large one. Sometimes, however, projects take on a life of their own and expand way beyond what you originally had in mind. When that happens, you have to take the situation in hand and decide what to do.

Breaking a movie into several individual movies involves copying frames from the current movie into a new blank movie or duplicating the movie you have and eliminating the frames you don't need. That's easy enough; just highlight the frames you want to move to a new movie and choose Edit > Cut Frames. In your new movie, select frame 1 and choose Edit > Paste Frames. All the necessary assets are imported with their original library names intact. Unfortunately, you lose your layer names .

If you're pasting your frames into an existing movie, be a little careful. Unless you paste them into the same number of frames that they occupied in the original movie, results might not be what you expect. If you try to paste your frames into a single frame, Flash inserts new layers to accommodate the frames and layers you're pasting. If, however, you highlight a series of frames and layers to paste into, Flash happily pastes your new frames without adding additional layers to your movieas long as you highlight the same number of frames (or more) that you cut or copied from the first movie.

Okay, that part is easyjust break your big movie into a series of smaller movies. But how do you get your new smaller movies to load? You have a couple options. You can load the movies based on a specific event, such as entering a particular frame, or you can load them based on user demand. The second method, loading on demand, is especially effective on large sites where the user might be looking for specific information. You are giving them just what they want.

If you're going to let the user choose when to load extra movies, you need to attach actions to the appropriate buttons to let them make that choice. The actions you need are quite simple; all you need to do is tell Flash what button event it should react to (press, release, and so on) and then add a loadMovie() or loadMovieNum() action.

The loadMovie() and loadMovieNum() actions can take the following parameters:

  • URL. This is required. It is the URL to the movie being loaded.

  • Target or Level. This is required. You can target a movie to replace by specifying a path , or you can load your movie into a new level (see the following Note). If you specify 0 for the level, the loadMovie action replaces the base movie in level 0. Any movies loaded into other levels are unloaded.

  • Variables . This is optional. Your choices are GET or POST, and you can use this option if you are sending variables with the movie to load. GET attaches any variables to the URL string. This is fine for short strings. POST sends the variables in a separate HTTP header. This method is better suited to longer strings.

Note

The loadMovie() action is used to load an SWF to a target, and loadMovieNum() is used to load an SWF to a level. When you are working in Normal mode in the Actions panel, Flash chooses the appropriate function for you. If you're working in Expert mode, you need to make that choice for yourself.


If you load a movie into a level that already contains a movie, the new movie replaces the old movie. If you load your movie into unique levels, you need to unload them using the unloadMovie action. If you don't unload the movies, you end up with layered movies, which might or might not be what you intended.

For loadMovie(), the syntax is the following:

 on (release) {        loadMovie("newmovie.swf", "_root.oldmovie");  } 

For loadMovieNum(), the syntax is the following:

 on (release) {        loadMovie("newmovie.swf", 1);} 

That's really all there is to loading new movies into an existing Flash movie. Just remember that if you don't target a movie or don't load into a level that already has a movie in it, you have to use unloadMovie()and unloadMovieNum() to clear any existing movies.



Inside Flash
Inside Flash MX (2nd Edition) (Inside (New Riders))
ISBN: 0735712549
EAN: 2147483647
Year: 2005
Pages: 257
Authors: Jody Keating

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