Specifying a Print Area

I l @ ve RuBoard

You can use the boundingBox parameter of the print action to specify a print area. This can be useful, for example, if you want to create a letter-size printout when your movie is 550 by 400 pixels. You just need to specify a print area for the printable content, and Flash will create your printout at whatever size you want. You will learn how in the following exercise. Start this exercise with map7.fla open from the last exercise.

  1. Open the Printable Map movie clip in symbol-editing mode.

    graphics/10fig26.gif

    Double-click the instance of the Printable Map symbol on the stage, or select the instance and choose Edit > Edit Symbols.

  2. Add a new layer, named Label. Select frame 2 of the new layer and insert a keyframe. Select frame 2 of the Background layer and insert a frame.

    graphics/10fig27.gif

    Place the new Label layer at the top of the layer stacking order. You're going to add labels to this layer, and it's a good idea to place labeled frames where they are easy to see and find.

    After you add the new layer, select frame 2 of new layer and choose Insert > Keyframe. There should already be an empty keyframe in frame 1, and when you insert a keyframe in frame 2, you will have two empty keyframes in the Label layer.

    Select frame 2 of the Background layer, and choose Insert > Frame. You don't need to add a keyframe to this layer; you only want the content from the previous frame (frame 1) to continue for two frames.

  3. Select frame 1 of the Labels layer, and set the Frame label to #p.

    graphics/10fig28.gif

    The #p label specifies a frame as printable. When you specify a frame (or frames) as printable, only that frame (or frames) will be printed by the print action. Any frame(s) that are not labeled with a #p will be ignored by the print action.

  4. Select frame 2 of the Labels layer, and set the Frame label to #b.

    graphics/10fig29.gif

    The #b label specifies that a frame contains the shape you would like to use as your print area. In other words, this frame will act as the bounding box for your printed movie clip. Frame 2 of the Background layer contains a large white rectangle, which is 612 pixels wide by 792 pixels highapproximately the size of a piece of letter-size paper (8.5 inches wide by 11 inches high).

    NOTE

    You can specify only a single frame in a timeline as the bounding box. You should not label more than one frame #b.

    Test the movie to see how it looks. The printed movie clip probably still doesn't look quite right (see the figure below). You have to make one more change before everything is in perfect working order. You'll do that in the next step.

    graphics/10fig30.gif

  5. Click the Scene 1 icon, and select frame 1 of the Actions layer in the main timeline. Change the boundingBox parameter for the print action in the printContent function to "bmovie" .

    graphics/10fig31.gif

    After you make this change, the printContent function should look like this:

      function printContent(btn) {   var pc = "c" + btn._name.slice(1, btn._name.length);   print(pc, "bmovie");   }  

    The boundingBox parameter of the print function can have one of three settings: "bmovie" , "bframe" , or "bmax" .

    The "bmovie" setting you used in the printContent function lets you use the shape in the frame labeled #b as the bounding box for the printed content. The contents of frame 2 of the Background layer will act as the print area for the Printable Map movie clip. That works out wonderfully, because that shape is approximately the same size as a sheet of letter-size paper.

    If you set the boundingBox to "bmovie" and didn't label a frame in the targeted movie clip or level with #b, Flash simply uses the dimensions of the movie as the printable area. Try removing the #b label from frame 2 of the Printable Map movie clip to see what this looks like, or take a look at the figure below.

    graphics/10fig32.gif

    Setting the boundingBox parameter to "bframe" will set the print area to the bounding box of the contents of each frame. Flash will scale the contents of each frame to fit the printed page.

    The "bmax" setting uses the maximum area of all printable frames in the timeline as the print area. So if you have three printable frames, one with a 300-by-200 object, another with a 200-by-300 object, and a third with a 200-by-200 object, the print area will be 300 by 300 pixels.

    NOTE

    When you use the "bmax" and "bframe" settings for the boundingBox parameter, frames labeled #b in the targeted timeline will be ignored.

  6. Choose Control > Test Movie, and click the Print Map button.

    graphics/10fig33.gif

    When you print the map this time, it should fit quite nicely on the printed page. After you print a copy of the map, close the Test Movie window.

    NOTE

    The background color for your movie is orange, but the map should have printed with a white background. This is not the default behavior for Flash; rather, the large rectangle in the Background layer acts as the background for the printed content. If you change the color of the rectangle shape, the color in the printed map will reflect that change.

  7. Save the movie as map8.fla in the FlashTFS folder.

    You're now a printing pro! If you would like to work through some additional tutorials on printing, be sure to visit the Flash TFS Web site.

I l @ ve RuBoard


Macromedia Flash MX. Training from the Source
Macromedia Flash MX: Training from the Source
ISBN: 0201794829
EAN: 2147483647
Year: 2002
Pages: 115
Authors: Chrissy Rey

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net