396
Chapter 6: ActionScript Core Classes
Description
Method; displays the operating system’s print dialog boxes and starts spooling. The print dialog
boxes let the user change print settings. When the
PrintJob.start()
method returns
successfully, the following read-only properties are populated, representing the user’s print
settings:
After the user clicks OK in the Print dialog box, the player begins spooling a print job to the
operating system. You should issue any ActionScript commands that affect the printout, and you
can use
PrintJob.addPage()
commands to send pages to the spooler. You can use the read-only
height, width, and orientation properties this method populates to format the printout.
Because the user sees information such as “Printing page 1” immediately after clicking OK, you
should call the
PrintJob.addPage()
and
PrintJob.send()
commands as soon as possible.
If this method returns
false
(for example, if the user clicks Cancel instead of OK in the
operating system’s Print dialog box), any subsequent calls to
PrintJob.addPage()
and
PrintJob.send()
will fail. However, if you test for this return value and don’t send
PrintJob.addPage()
commands as a result, you should still delete the PrintJob object to make
sure the print spooler is cleared, as shown in the following example:
var my_pj:PrintJob = new PrintJob();
var myResult:Boolean = my_pj.start();
if(myResult) {
// addPage() and send() statements here
}
delete my_pj;
Example
The following example shows how you might use the value of the orientation property to adjust
the printout:
// create PrintJob object
var my_pj:PrintJob = new PrintJob();
// display print dialog box
if (my_pj.start()) {
// boolean to track whether addPage succeeded, change this to a counter
// if more than one call to addPage is possible
var pageAdded:Boolean = false;
Property
Type
Units Notes
PrintJob.paperHeight
Number
Points
Overall paper height.
PrintJob.paperWidth
Number
Points
Overall paper width.
PrintJob.pageHeight
Number
Points
Height of actual printable area on the
page; any user-set margins are ignored.
PrintJob.pageWidth
Number
Points
Width of actual printable area on the
page; any user-set margins are ignored.
PrintJob.orientation
String
N/A
“Portrait” or “landscape.”
Summary of Contents for FLEX
Page 1: ...Flex ActionScript Language Reference ...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Page 135: ...case 135 See also break default strict equality switch ...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Page 808: ...808 Chapter 7 ActionScript for Flash ...
Page 810: ...810 Appendix A Deprecated Flash 4 operators ...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Page 822: ...822 Index ...