Printing in Flash
Printing in Flash
In earlier versions of Flash, printing out your movies was really hard work. Flash MX 2004 introduced the PrintJob class which gave us much more control over printing. It also made the process a whole lot easier.
You can use the PrintJob class to print the Stage from your Flash movie or you can set up movies made especially for printing. These special print movies don’t need to be visible within your main Flash document and they can even be located on a different frame. It’s also possible to create the print movie clip and load the content entirely in ActionScript, before you print it out.
In this tutorial, I want to show you how to get started with the PrintJob class. We’ll look at how you can use it to print the Stage from your Flash movie and then we’ll print out a movie clip that isn’t visible in the published SWF file.
Because the PrintJob class was introduced in Flash Player 7, you’ll need to have at least Flash MX 2004 to complete this tutorial and you’ll have to target Flash Player 7 and above when publishing. You can download the resource files for this tutorial from the blue Properties box that contains the article PDF. There's a heading titled Code Download and you can click the Details link next to it to get the zip file. The zip file includes the starter Flash file, a text file that we’ll load and my completed file.
Note: If you have difficulties downloading the source files or PDF, you might have a problem with your cookies. Delete the cookies from your machine and try again. In Internet Explorer, you can do this by choosing Tools > Internet Options… and clicking the Delete Cookies… button on the General tab.
We’ll start off by looking at the PrintJob class.
Sas Jacobs
Hello. I'm the Principal of Anything Is Possible, an Australian web development business specialising in web applications development and training. I'm interested in using Flash with dynamic content and I've presented at a number of International conferences on topics relating to applications development, XML and scripting components. I have recently released my second print book Beginning XML with DOM and Ajax to match the first one - Foundation XML for Flash. I have a business web site
and a personal web site.