Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Powerful Printing in Flash : Page 3

Use Flash's robust printing support to add print functionality to your Flash movies or Web applications. By using off-screen movie clips and ActionScripts movie clip copying commands, effective printouts can be assembled on the fly.


advertisement
Printing Options
To meet the client's printing requirements, you have 2 choices: you can use the Flash Player context menu (the popup menu available by right-clicking on the Flash movie) or you can use the ActionScript print() command. To print using the context menu, the user right-clicks on the Flash movie and selects Print from the pop-up menu (see Figure 2).

 
Figure 2: The Flash Player Context Menu. The standard context menu in the Flash player, which includes the default printing option.

Determine which frames should print by labeling frames in the movie with #p. Beware, however—this strategy has a couple of problems:

  • Your users might not know the context menu exists, so clearly indicate that the movie supports printing by using your own print button.
  • The ability to customize the printout format is limited in this application. You'll need to add the exhibit info and date.
The native ActionScript printing commands (print(), printAsBitmap(), and printNum()) are much more powerful than the Flash Player menu's print command. A full explanation of these commands is available in the Macromedia documentation. Note that, unlike printing from the context menu, these commands allow you to specify what is printed: movie clip, a set of frames, or a level in the movie. Here, you'll use the most basic command: print().



Adding Printing to Your Movie
To add printing support, drop a button on your interface and wire its ActionScript handler (the function which handles the user's click) up to ActionScripts print() command. In this case, send in a reference to the drawingArea clip and specify the bframe parameter. The button handler looks like this:

printButton.onPress = function() { print(drawingArea, "bframe") }

Now when users click on the button, Flash sends the printer the image of the drawingArea clip, including all the circle clips attached to it.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap