Với kịch bản này, một trường hợp mới của lớp PrintJob được tạo ra và được gọi là myPrintJob. Để cho đối tượng PrintJob những gì nội dung in, bạn phải sử dụng addPage () phương thức của lớp PrintJob. Chúng tôi sẽ nhận được để điều này sớm. Trước khi bạn có thể sử dụng addPage () để thêm tất cả nội dung in đến công việc in ấn, tuy nhiên, trước tiên bạn phải gọi bắt đầu () phương thức của lớp PrintJob: var myPrintJob: PrintJob = new PrintJob (); var kết quả: Boolean = (); . | Using the PrintJob Class The PrintJob class is a built-in Flash class that gives the programmer control over what can be printed in an SWF as well as how it s printed. To use the PrintJob class a new instance of the class must be created. var myPrintJob PrintJob new PrintJob With this script a new instance of the PrintJob class is created and referred to as myPrintJob. To tell the PrintJob object what content to print you must use the addPage method of the PrintJob class. We ll get to this soon. Before you can use the addPage method to add all printable content to the print job however you must first call the start method of the PrintJob class var myPrintJob PrintJob new PrintJob var result Boolean The first line of this script creates the instance of the PrintJob class. The second line invokes the start method. The moment that the start method is called a pop-up window specific to the operating system asks whether the user wants to proceed with printing. If the user selects Print the Boolean value true is returned and stored as the value of the variable result. If the user doesn t have a printer installed or cancels the print pop-up window the Boolean value false is returned. This feature allows you to program an application to react one way if the user successfully initializes the print option and another if the user cancels the print request or doesn t have a printer. For example var myPrintJob PrintJob new PrintJob var result Boolean if result Successfully initialized print action Add pages to print here else User does not have printer or user canceled print action NOTE After the start method is called but before the user responds to the pop-up window Flash is paused and no frames are executed. All animations and code halt until the user responds. If the value of result is true the user has a printer and has chosen the Print option. It s then time to use the addPage method of the PrintJob class to add the printable content. The