Using Variables for Generator Settings


Using Variables for Generator Settings

One powerful aspect of Generator is that you can use variables instead of specific values to define a Generator object's settings. What that means for you is that you can pass values through a data source to the object instead of typing new values in the Generator panel every time you need to make a change.

Exercise 4.8 Using Variables to Replace Settings

You now change the Set Tint settings to variables and add the new variables to your existing data source (data.txt).

  1. You still should have banner7.fla open. If not, open it now.

  2. Select the Company movie clip instance on the Stage. The Generator panel still should show the Set Tint settings.

  3. Change the values in the Generator panel (see Figure 4.16) to the following variables:

    Percent: {percent}

    Red: {red}

    Green: {green}

    Blue: {blue}

    Figure 4.16. The Set Tint values replaced with variables.

    graphics/04fig16.gif

  4. Save your file as banner8.fla.

  5. Open your data source, data.txt, in your text editor of choice and add the following lines to the end of the file:

    percent, 50

    red, 0

    green, 255

    blue, 0

    You'll be applying a pure green tint at 50 percent. This deepens the green for the company name .

    To apply the same color change to the tag line, you would repeat Step 3 for the Tag movie clip instance. No changes to the data source are required. But why not be more interesting than that? Set up the Tag movie clip so that you can control its color separately from the Company movie clip.

  6. Select the Tag movie clip instance on the Stage and select the Set Tint symbol command in the Generator panel.

  7. Change the values in the Generator panel to the following variables:

    Percent: {tag_percent}

    Red: {tag_red}

    Green: {tag_green}

    Blue: {tag_blue}

  8. Save your file.

  9. Open your data source, data.txt, in your text editor of choice and add the following lines to the end of the file:

    tag_percent, 100

    tag_red, 0

    tag_green, 255

    tag_blue, 0

  10. Save the text file and test your Generator template.

Now the company name should be a muted green, and the tag line should be bright green.



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