Printing from Flash Player

I l @ ve RuBoard

Flash gives you the option of letting your viewers print some or all of a movie directly from Flash Player. You can allow viewers to access a print command from Flash Player's contextual menu. By default, the contextual menu's Print command prints every frame in the movie. You restrict printing to certain frames by labeling them as printable in the original Flash document. You can also create buttons for printing frames of your Flash movie.

To set frames to print from the contextual menu:

  1. Create a Flash document with three keyframes.

    Place different content in each frame to make it easy to tell which frames you've actually printed. Add a stop action to each keyframe, and add a button with a play action so that you can move from frame to frame in the published movie.

  2. In the Timeline, select Keyframe 1.

  3. Access the Frames Property Inspector.

    If the Frames Property Inspector is not open , choose Window > Properties.

  4. To define the selected frame as printable, in the Label field, enter #p (Figure 16.54).

    Figure 16.54. To define keyframes that print when viewers choose Print from Flash Player's contextual menu, select the keyframe and enter #p in the Label field of the Frame Property Inspector.

    graphics/16fig54.gif

  5. In the Timeline, select Keyframe 3.

  6. Repeat Step 4.

  7. Publish your Flash movie, and view the resulting Flash Player file in your browser.

  8. To access the contextual menu, Control-click (Mac) or right-click (Windows) anywhere in the movie window.

    The contextual menu appears (Figure 16.55).

    Figure 16.55. In your browser, Control-click (Mac) or right-click (Windows) to access Flash Player's contextual menu. Choosing Print outputs all the pages defined as printable.

    graphics/16fig55.gif

  9. Choose Print.

    Flash prints the frames you labeled as printable (frames 1 and 3) and skips the frame that doesn't contain the #p label (Frame 2).

graphics/01icon02.gif Tips

  • If there are no frames with the #p label in the movie, the contextual menu's Print command prints each frame in the movie.

  • If you define more than one frame as printable by labeling it #p , when you publish the movie, Flash displays a warning message in the Output window, letting you know that there are multiple frames with the same label name . If the only duplicates are #p labels, just ignore the warning.


You can also create buttons that use ActionScript to print selected frames.

To set frames to print from a button:

  1. Open the file you created in the preceding exercise.

    Keyframes 1 and 3 already contain the frame label #p . Even when you print via ActionScript, you must define the printable frames with this frame label.

  2. Place an instance of a button in Keyframe 1.

  3. With the button selected on the Stage, access the Actions-Button panel.

  4. From the Add menu, choose Actions > Printing > print .

    Flash updates the Script pane to look like Figure 16.56.

    Figure 16.56. Attaching a print action to an instance of a button is another way to give viewers the ability to print the contents of your movie.

    graphics/16fig56.gif

  5. In the Script pane, select Line 2.

    The parameters for the print action appear in the Parameters area (Figure 16.57).

    Figure 16.57. The parameters for the print action allow you to control print quality and print area, in addition to targeting a particular Timeline for printing.

    graphics/16fig57.gif

  6. To set print quality, from the Print pop-up menu, choose one of the following:

    • To print at high quality, without transparency, choose As Vector.

    • To preserve transparency effects, choose As Bitmap.

  7. To designate which Timeline to print when you have loaded more than one movie (or you want to print a particular movie clip), from the Location menu, choose one of the following:

    • Choose Level, and enter the level number of the loaded movie.

    • Choose Target, and enter the target path of the movie clip.

  8. To define the print area, from the Bounding pop-up menu, choose one of the following options:

    • To use an object in a particular frame as a template for setting the print area, choose Movie. For the Movie option to work, you must also define the template frame. Select the frame containing the template object, access the Frame Property Inspector, and enter #b as the frame label (Figure 16.58).

      Figure 16.58. The #b frame label tells Flash to use the objects in this frame as the bounding box for printed output. The black rectanglethe only object in the #b framedefines the print area in the published movie.

      graphics/16fig58.gif

    • To vary the print area to enclose just the objects in each frame and scale those objects to fit the page, choose Frame.

    • To make the print area large enough to print all the objects in all the movie's frames, choose Max.

graphics/01icon02.gif Tips

  • If you want to give your end users the ability to print items one at a time, instead of printing all the printable frames in your movie each time they choose Print (or click a button with a print command in its script), put the printable items in movie clips. You can then use buttons whose scripts target individual movie clips for printing.

  • Using the #b label to create a bounding box for printing can be a bit tricky in a movie with many layers . All the objects in the #b frameno matter what layer they live inbecome part of the print area.

  • The bounding-box object need not be visible in the final movie. Place an instance of a movie clip as your bounding-box object, and use onClipEvent (load) to set the instance's _visible property to false .


To disable printing from Flash Player:

  1. Open the Flash file for which you want to disable printing.

  2. In the Timeline, select any frame.

  3. Access the Frame Property Inspector.

  4. In the Label field, enter !#p .

    When you publish the file, the Print option is unavailable from Flash Player's contextual menu (Figure 16.59).

    Figure 16.59. Attaching the label !#p to any frame in a movie (top) grays out the Print option in the contextual menu of Flash Player (bottom).

    graphics/16fig59.gif

graphics/01icon02.gif Tip

  • You can remove the contextual menu from your published Flash Player file by unchecking the Display Menu checkbox in the Playback section of the HTML tab of the Publish Settings dialog box (Figure 16.60).

    Figure 16.60. Deselecting the Display Menu checkbox in the HTMLtab of the Publish Settings dialog box (top) limits the functions of the contextual menu for your published movie and is one way to disable printing from within your movie (bottom). The browser's print functions will still be available, however.

    graphics/16fig60.gif


I l @ ve RuBoard


Macromedia Flash MX for Windows and Macintosh. Visual QuickStart Guide
Macromedia Flash MX 2004 for Windows and Macintosh (Visual QuickStart Guides)
ISBN: 0582851165
EAN: 2147483647
Year: 2002
Pages: 243

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