Setting Up Your Movie for Printing

I l @ ve RuBoard

You need to do a few things to your movie before you can use any ActionScript print commands. Unfortunately, the print commands are not versatile. If used without any preparation, they will print the entire contents of the movie, frame by frame.

This is usually not what you want. You may want only the current frame printed, perhaps a frame inside a specific movie clip, or maybe a small series of frames . But rarely will you want every single frame printed.

Labeling Frames for Printing

You specify that a frame should be printed by labeling it with a #p. If you don't place a #p label on any frame, the print commands will print all frames in your movie. On the other hand, if you place more than one #p frame in your movie, just those frames will be printed.

Figure 20.1 shows a timeline with two frames labeled for printing. Notice that those same frames are also labeled in another layer. You can place more than one label on a frame this way. This comes in handy because you probably don't want to use #p as a real label, and you may want to have more than one frame with a #p label.

Figure 20.1. Frames 2 and 4 are labeled for printing.



When you label more than one frame with a #p, you will get a warning when you test the movie: "WARNING: Duplicate label ". It is unfortunate that this happens, but it will not affect your movie unless you try to use the #p labels in gotoAndStop commands and such.

A Printing Strategy

You really need to think ahead to build printing into your movie. Because you can't just print the current frame, you will need to build special printable frames.

Note that everything visible on the frame gets printed. This includes a Print button, if you have one, plus any navigation buttons . So you probably want to have a Print button on one frame, and then have a frame that is identical to that one but without the Print button or other unwanted elements. This frame has the #p label on it.

You can organize this using the main timeline layers. For instance, you could have Print and navigation buttons on separate layers from the page's content. These layers , which you do not want printed, will not extend to the print frame.

Figures 20.2 and 20.3 illustrate this kind of system. Figure 20.2 is the frame that the user sees on the Web page. It features the content, a navigation button, and a Print button.

Figure 20.2. This is the frame the user sees onscreen, which includes elements that shouldn't be printed.


On the other hand, Figure 20.3 shows a frame that the user never sees ”at least not on the screen. It is labeled with a #p, which you can see in the timeline. The Buttons layer does not use the same key frame as the previous frame. Instead it uses a new key frame that excludes the button but includes additional information meant for the printout only.

Figure 20.3. This frame is meant to be printed.


Now that you know how to prepare your movie, let's look at the ActionScript needed to print.

I l @ ve RuBoard

Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272 © 2008-2017.
If you may any questions please contact us: