03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The colors, alphas, <strong>and</strong> ratios properties are all related. The first element in the colors<br />

array corresponds to the first element in the alphas array <strong>and</strong> in the ratios array, <strong>and</strong> so on.<br />

To underst<strong>and</strong> how the colors in a gradient bevel are distributed, think first of the colors that<br />

you want in your gradient bevel. Consider that a simple bevel has a highlight color <strong>and</strong><br />

shadow color; a gradient bevel has a highlight gradient <strong>and</strong> a shadow gradient. Assume that<br />

the highlight appears on the top-left corner, <strong>and</strong> the shadow appears on the bottom-right<br />

corner. Assume that one possible usage of the filter has four colors in the highlight <strong>and</strong> four in<br />

the shadow. In addition to the highlight <strong>and</strong> shadow, the filter uses a base fill color that<br />

appears where the edges of the highlight <strong>and</strong> shadow meet. Therefore the total number of<br />

colors is nine, <strong>and</strong> the corresponding number of elements in the ratios array is nine.<br />

If you think of a gradient as composed of stripes of various colors, blending into each other,<br />

each ratio value sets the position of the color on the radius of the gradient, where 0 represents<br />

the outermost point of the gradient <strong>and</strong> 255 represents the innermost point of the gradient.<br />

For a typical usage, the middle value is 128, <strong>and</strong> that is the base fill value. To get the bevel<br />

effect shown in the image below, assign the ratio values as follows, using the example of nine<br />

colors:<br />

■ The first four colors range from 0-127, increasing in value so that each value is greater<br />

than or equal to the previous one. This is the highlight bevel edge.<br />

■ The fifth color (the middle color) is the base fill, set to 128. The pixel value of 128 sets the<br />

base fill, which appears either outside the shape (<strong>and</strong> around the bevel edges) if the type is<br />

set to outer; or inside the shape, effectively covering the object's own fill, if the type is set<br />

to inner.<br />

■ The last four colors range from 129-255, increasing in value so that each value is greater<br />

than or equal to the previous one. This is the shadow bevel edge.<br />

If you want an equal distribution of colors for each edge, use an odd number of colors, where<br />

the middle color is the base fill. Distribute the values between 0-127 <strong>and</strong> 129-255 equally<br />

among your colors, then adjust the value to change the width of each stripe of color in the<br />

gradient. For a gradient bevel with nine colors, a possible array is [16, 32, 64, 96, 128, 160,<br />

192, 224, 235]. The following image depicts the gradient bevel as described:<br />

GradientBevelFilter (flash.filters.GradientBevelFilter) 637

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!