EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 523

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Working with filters using ActionScript 523
square_mc.lineTo(40, 200);
square_mc.lineTo(40, 40);
square_mc.endFill();
/* GradientBevelFilter(distance:Number, angle:Number, colors:Array,
alphas:Array, ratios:Array, blurX:Number, blurY:Number, strength:Number,
quality:Number, type:String, knockout:Boolean) */
// create colors, alphas, and ratios arrays
var colors:Array = [0x0000FF, 0x00FF00, 0x9900FF, 0xFFFF00, 0xFF0000,
0xFFFF00, 0x9900FF, 0x00FF00,0x000000];//blue, green, purple, yellow,
red, yellow, purple, green, black
var alphas:Array = [1, 1, 1, 1, 1, 1, 1, 1, 1];
var ratios:Array = [16, 32, 64, 96, 128, 160, 192, 224, 235];
// create the filter object
var gradientBevel:GradientBevelFilter = new GradientBevelFilter(8, 225,
colors, alphas, ratios, 16, 16, 1.3, 2, "inner", false);
// apply the filter to the square movie clip
square_mc.filters = [gradientBevel];
Applying a gradient bevel filter
The GradientBevelFilter class lets you apply a gradient bevel effect to objects in Flash. A
gradient bevel is a beveled edge that’s enhanced with gradient color on the outside, inside, or
top of an object. Beveled edges bring a three-dimensional look to objects, and can have
colorful results as shown in the following figure.
For more information on this filter, see GradientBevelFilter
(flash.filters.GradientBevelFilter) in the ActionScript 2.0 Language Reference.
The following procedure uses the Drawing API to draw a square on the Stage, and applies a
gradient bevel filter to the shape.

Table of Contents

Related product manuals