Flash CS4 ActionScript 3.0 Tutorial
How to Add a Bevel to an Object with Flash ActionScript
Filters can be added to Movie Symbols and Text objects in Flash with the Properties panel. They can also be added to an object with ActionScript. You can choose from several different filters. For information on all the filters available, see topics, Blur Filter, Drop Shadow Filter, and Glow Filter. Another advantage to creating filters this way is that you can create the filter once, then apply it to multiple objects.
This tutorial is an example of applying the Bevel filter with ActionScript.
Movie Symbol with instance name filterObj_mc
Add a Movie Symbol to the stage and select the symbol with the Selection tool (v key).
Open the Properties panel (Cmd/F3 (PC-Ctrl/F3)) and type in the name filterObj_mc for the Instance Name.
Add a new layer called Actions.
Option double-click (PC - Alt double-click) the keyframe in the Actions layer to open the ActionScript panel.
Copy/Paste the following code to the ActionScript panel.
var filterVar:BevelFilter = new BevelFilter(10, 45, 0xFFFFFF, .6, 0x444444, .8, 5, 6, .4, 1,"inner", false);
//BevelFilter Options: distance, angle, hightlightColor, highlightAlpha, shadowColor, shadowAlpha, blurX, blurY, strength, quality, type ("inner", "outer", or "full), false = no knockout true = knockout;
Test your movie by pressing Cmd/Return (PC - Ctrl/Enter). The Bevel filter is added to your object.
Dissecting the Code
The first line establishes a new BevelFilter variable named filterVar.
The filter contains an array of 12 values:
10 = distance (Number)
45 = angle (Number)
0xFFFFFF = highlightColor (uint)
.6 = highlightAlpha (Number (0-1))
0x444444 = shadowColor (uint)
.8 = shadowAlpha (Number (0-1))
5 = blurX (Number)
6 = blurY (Number)
.4 = strength (Number (0-1))
1 = quality (int (1-3))
"inner" = type (String ("inner", "outer", or "full")
false = knockout (Boolean (true=knockout))
The final line connects the filter variable to the object.