Printing with Flash
- Preparing Frames for Printing
- Determining the Print Area
- Creating Print Buttons
- How It Works
Anyone not paying close attention probably missed the addition of printing capabilities into Macromedia Flash 5. In actuality, printing was added late in the life of Flash 4, and, unfortunately, it is one of the best-kept secrets about the Flash Player format.
The limitations of printing from a Web browser are many: inconsistent rendering of content between browsers, no vector graphics support, limited capability to print frames...and the list goes on. Flash printing overcomes these problems by providing a standardized Player that has full vector and bitmapped graphics support—plus, of course, full-color rendering. What's most compelling however, is that Flash can print content that is not visible to the user and that is a different size than the current movie. So, it's easy to format your Web movie to suit a browser, yet simultaneously offer material formatted for the printed page.
This article covers the preparation of a series of Navy Bay posters and the scripting of buttons that allow the user to print each one (see Figure 1). Flash Player supports two primary methods of printing: the less precise option of right-clicking the Player and choosing the Print command, and the laser-beam–accurate method of using scripted buttons and the print action.
Figure 1 A look at the finished product.
Preparing Frames for Printing
In this section, the Navy Bay posters will be prepared for printing. By default, all Flash frames are printable, but it is also possible to disable printing of some parts of a movie and not others.
-
Download the zip file containing all the necessary project files in ZIP format (300k) here or HQX format (316k) here. Unzip the files and open Printables_start.fla.
-
To disable printing of the main timeline, select the first key frame of any layer. Open the Frame panel, and type !#p in the Label field (see Figure 2).
-
To enable printing of the first poster, open the Library and locate Poster One in the Posters folder. Double-click to edit it.
-
Select the first key frame of the Poster layer, and open the Frame panel. Type #p into the Label field (see Figure 3).
-
Repeat Steps 3 and 4 for both Poster Two and Poster Three
On the stage, you'll see that an instance of each poster symbol has been resized for display and placed in a row. These three symbols contain the content that will be printed by the user.
Figure 2 Type !#p as the frame label for the first frame of any layer on the main timeline.
NOTE
In programming circles, the exclamation mark is usually interpreted as "don't" or "isn't." For example, if you want to show that 1 is not equal to 2 in ActionScript, you could use the expression 1 != 2, where != means "isn't equal to." In this case, the exclamation precedes #p, which is the label used to allow the printing of a particular frame.
Figure 3 Type #p as the frame label for the first frame of the Poster One layer to make the Poster One Movie Clip printable.
This will explicitly allow this frame to be printed by the print action. The print action can be assigned to buttons so that users can click and choose which object to print.