beautypg.com

Adobe Flash Professional CC 2014 v.13.0 User Manual

Page 655

background image

PrintJob.pageWidth

number

points

Width of actual printable area
on the page; does not include
any user-set margins

PrintJob.orientation

string

n/a

Portrait or landscape
orientation

Adding pages to a print job

You add pages to your print job with the ActionScript 2.0 PrintJob.addPage() method. Although the method can include as many as four
parameters, the only required parameter is target/level. The three optional parameters are printArea, options, and frameNum.

If you are not using a particular optional parameter but are using other optional parameters, use NULL in place of the excluded optional parameter.

With all four parameters, the function uses the following syntax:

MyPrintJob.addPage(target[,printArea:Object, options:Object, frameNum:Number]):boolean;

If you provide an invalid parameter, the print job uses default parameter values.

Each call to add a new page is unique, which lets you modify parameters without affecting previously set parameters. For example, you can
specify that one page print as a bitmap image and another page print as a vector graphic. You can add as many new pages to your print job as
the print job requires. One call to add a page equals one printed page.

Note: Any ActionScript code that needs to be called to change a resulting printout must run before the PrintJob.addPage() method is called. The
ActionScript can, however, run before or after a new PrintJob()method. If a frame has a call to PrintJob.addPage(), the call itself does not
guarantee that the ActionScript script on that frame will run when that frame is printed.

Specifying a target

The ActionScript 2.0 target parameter can be either a number that represents a level (such as 0 for the _root document), or a string that
represents the instance name of a movie clip ("myMovieClip").

Specifying a print area

The optional printArea parameter includes the following values:

{xMin:Number, xMax:Number, yMin:Number, yMax:Number}

The xMin, xMax, yMin, and yMax values represent screen pixels relative to the target level or movie clip registration point. The print area
orientation is from the upper-left corner of the printable area on the page. If the print area is larger than the printable area on the page, the print
data that exceeds the right and bottom edge of the page is clipped.

A. Paper rectangle B. Page rectangle C. (594,774) D. (576,756) E. (0,0) F. (-18,-18)

If you don’t specify a print area, or if you specify an invalid print area, the print area defaults to the Stage area of the root document.

Scaling, points, and pixels

A print job using the PrintJob class prints Flash Professional content, by default, without scaling it. For example, an object that is 144 pixels wide
on screen prints as 144 points, or 2 inches wide.

One point equals one pixel. In the authoring tool, 72 pixels equals one inch; on paper, 72 points equals one inch.

To understand how Flash Professional screen content maps to the printed page, it helps to understand screen and print units of measure. Pixels

648