print( ) Global Function

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
print( ) Global Function Flash 5

print the frames of a movie or movie clip using vectors
print(target, boundingBox)

Arguments

target

A string or reference indicating the path to the movie clip or document level to print (references are converted to paths when used in a string context).

boundingBox

A string indicating how the printed frames of target should be cropped when printed. Cropping is defined by a bounding box that represents the entire printed page. The region of target included in the printed page can be set using one of three legal values for boundingBox (which must be a literal string):

"bframe"

The bounding box for each printed frame is set individually to match the size of each frame's contents. Hence, every printed frame's content is scaled to fill the entire printed page. This maximizes the size of the printed images.

"bmax"

The area occupied by the content of all printed frames is combined to form a maximum bounding box. Each printed frame's content is scaled and placed on the printed page relative to the maximum bounding box. That is, each frame maintains its size relative to other frames, but all frames don't necessarily fill the printed page.

"bmovie"

The bounding box for all printed frames is set to the size of a single, designated frame in the target clip. Content of printed frames larger than the designated frame is cropped to the bounding box of the designated frame. Content of printed frames smaller than the designated frame is not scaled. To designate a frame as the one on which the bounding box should be based, assign it the label #b.

Description

Printing a Flash movie using a web browser's built-in File figs/u2192.gif Print function behaves inconsistently and often results in poor quality printouts that don't use vector printing. In some browsers, the movie won't print at all, nor will most browsers print more than one frame at a time. Using the print( ) function, we can print the contents of one or more frames of a movie with accuracy and quality, directly from Flash. By default, print( ) causes all of the frames of target's timeline to be printed, one frame per page, cropped or scaled according to the boundingBox argument. To designate specific frames for printing (while excluding undesignated frames), we assign the label #p to the desired frames.

The print( ) function sends vectors directly to PostScript printers and sends vectors converted to bitmaps to non-PostScript printers. Because print( ) uses vectors, it cannot be used to print movies with alpha transparency or color transformations. To print movies that have color effects, use printAsBitmap( ).

Usage

In Flash Player 4, the print functions are available via the Get Url Action (not available prior to build 4.0.20.0). For more details, see Macromedia's Flash Printing SDK, available at:

http://www.macromedia.com/software/flash/open/webprinting/authoring.html

Example

// Print every frame in the main movie timeline, scaling each to fill the page print("_root", "bframe");     // Print every frame in the main movie timeline, // sizing each frame relative to the combined size of all frames print("_root", "bmax");

When the print_btn button is clicked, Flash prints all frames in the button's parent timeline, cropped to the bounding box of the frame with the label #b, and sized to fill the page:

print_btn.onRelease = function () {   print(this._parent, "bmovie"); }

See Also

getURL( ), printAsBitmap( ), printAsBitmapNum( ), printNum( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

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