Nesting Symbol Commands


Having the company name and tag line always on the left side of the screen is somewhat limiting. Why not add in the capability to reposition the text? If you try to apply a new symbol command to the existing instances of the movie clips on the Stage, you overwrite the previous symbol commands. Remember, you can apply only one symbol command to each instance of a symbol on the Stage. Fortunately, there is an easy workaroundyou can nest symbols inside symbols.

Exercise 4.9 Using the Symbol Commands with Nested Symbols

Nesting symbols inside other symbols is a simple process. All you have to do is select an existing symbol, press F8 (Insert > Convert to Symbol), and give the symbol a new name. You haven't changed your old symbol; you've just wrapped it inside a new symbol.

  1. Continue working in banner8.fla or load it from the CD-ROM.

  2. Use the Arrow tool to select the Company movie clip instance on the Stage. Embed the Company movie clip in another movie clip by pressing F8 (Insert > Convert to Symbol) on your keyboard.

  3. In the Symbol Properties dialog box, type transform_company for the name of the symbol and accept the default movie clip behavior.

  4. With the transform_company movie clip selected, choose the Transform symbol command from the Generator panel.

  5. Change the values for the X Offset and the Y Offset to {comp_xoffset} and {comp_yoffset}, respectively.

  6. Save your file as banner9.fla.

  7. Open your data source file, data.txt, and add the following name/value pairs:

    comp_xoffset, 100

    comp_yoffset, 0

    You'll be moving the instance of transform_company on the Stage 100 pixels to the right. You won't be making any changes to the vertical position.

    Note

    Positive X Offset values move symbol instances to the right, and negative values move them to the left. Positive Y Offset values move symbols down and negative values move them up. Remember that the registration point for a Flash movie, which is the point where X and Y are both equal to zero, is the upper-left corner of the Stage.

  8. Save your text file and test your Flash movie.

    The company name should be offset by 100 pixels to the right of the tag line, assuming you had both aligned at the left side of the Stage in your template.

  9. Repeat Steps 3 through 7 for the Tag movie clip. Use transform_tag as the new symbol name. You'll need to set up the offset variables in the Generator panel. Use {tag_xoffset} and {tag_yoffset}. Finally, don't forget to add those variables to your data source.

  10. Save your data source. Save your Flash file as banner9.fla. Test away.

By now, you should have a good feel for how you can use Generator text variables to add dynamic text to a page. You've also seen how you can convert text variables to symbols and apply the Generator symbol commands to them.

Now it's time to spice things up a bit and use some of the predefined Generator objects. In the coming pages, you get a quick introduction to some of Generator's charting capabilities, and you'll then use some of the other objects to finish off your banner ad.



Inside Flash
Inside Flash MX (2nd Edition) (Inside (New Riders))
ISBN: 0735712549
EAN: 2147483647
Year: 2005
Pages: 257
Authors: Jody Keating

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