Blur Filter

Blur Filter

Flash CS4 ActionScript 3.0 Tutorial

 

How to Add an Object Blur 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, Bevel 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 Blur filter with ActionScript.

Tutorial Elements

Movie Symbol with instance name filterObj_mc

 

Step One

Add a Movie Symbol to the stage and select the symbol with the Selection tool (v key).

Step Two

Open the Properties panel (Cmd/F3 (PC-Ctrl/F3)) and type in the name filterObj_mc for the Instance Name.

Step Three

Add a new layer called Actions.

Step Four

Option double-click (PC - Alt double-click) the keyframe in the Actions layer to open the ActionScript panel.

Step Five

Copy/Paste the following code to the ActionScript panel.

var filterVar:BlurFilter = new BlurFilter(25, 2, 3);

//BlurFilter Options: blurX, blurY, quality;

filterObj_mc.filters=[filterVar];

Step Six

Test your movie by pressing Cmd/Return (PC - Ctrl/Enter). The Blur filter is added to your object.

Dissecting the Code

The first line establishes a new BlurFilter variable named filterVar.

The filter contains an array of 3 values:

25 = blurX (Number)

2 = blurY (Number)

3 = quality (int (1-3))

The final line connects the filter variable to the object.