• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 11. Adding Generator Content > Printing Flash Content

Printing Flash Content

If your site contains important information, your visitors might want to print some of it. They can try to use the Print command in their browsers, but that command often isn't adequate for printing Flash content. You can use Flash's built-in print capabilities to control the look of the printed content. In this exercise, you will create a movie clip containing only the dynamically generated chart. Then you will add some ActionScript that allows you to print just that chart.

1.
Select the Basic Charts object placeholder in frame 1 of the Chart layer in about4.fla. Choose Insert > Convert to Symbol. When the Symbol Properties dialog box opens, name the symbol Chart Clip, and set its behavior to Movie Clip.

You are going to use the Print action to print only the chart. To do that, you must place it inside a movie clip.

2.
Make sure you have the instance of the Chart Clip in frame 1 of the Chart layer. In the Instance panel, type chart in the Name text box.

The movie clip needs an instance name so that you can target it for printing.

3.
Select the instance of the Print Button in frame 1 of the Print Button layer, and apply the following ActionScript:

on (release) { 
  print ("chart", "bframe");
}

This ActionScript triggers a print action when the user releases the mouse button.

The print action has two arguments: target and type. The target argument specifies the path of the timeline that should be printed. If you want to print the main movie, you can set this argument to _root. If you want to print the contents of a movie clip, you should set this argument to the path of that movie clip. In this example, the movie clip that you want to print is the one with an instance name of chart.

The type argument specifies the bounding area for the print action. This argument can have one of three settings: bmovie, bframe, and bmax. Using bmovie makes the print action use the dimensions of the movie as the bounding area. The bframe option sets the bounding area for the printed content to the bounding area of each individual frame. You can use bmax to specify a bounding area set by the composite bounding area of all frames in the targeted movie clip. In this case, you are using bframe, so the printed content will scale to the bounding area of each individual frame. The targeted movie clip has only one frame, so the printed content will scale to that frame.

4.
Choose Control > Test Movie. When the test movie opens, click the Print button to print your chart.

Look at the printed chart. Notice that only the chart is printed, not the text or background. It should take up most of the page, which isn't exactly the result you want. The printed chart should have some margins so that it looks better.

5.
Close the test movie, and save the file as about5.fla in the MyWork folder.

You need to specify a bounding area, which is what you'll do in the following exercise.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint