Working with filters using ActionScript 509
3. Select Control > Test Movie to test the Flash document.
Move the mouse pointer along the x-axis to modify the amount of horizontal blurring.
The instance blurs more when the pointer moves farther away from the horizontal center
of the Stage. Moving the pointer along the y-axis causes the vertical blurring to increase or
decrease, depending on the distance from the vertical center of the Stage.
Using the drop shadow filter
The DropShadowFilter class lets you add a drop shadow to a variety of objects in Flash. The
shadow algorithm is based on the same box filter that the blur filter uses (see “Using the blur
filter” on page 507). Several options are available for the style of the drop shadow, including
inner or outer shadow and knockout mode.
For more information on the drop shadow filter, see DropShadowFilter
(flash.filters.DropShadowFilter) in the ActionScript 2.0 Language Reference.
The following procedure uses the Drawing API to draw a square on the Stage. When you
move the mouse pointer horizontally along the Stage, this code modifies the distance from the
square that the drop shadow appears, whereas moving the cusror vertically modifies how
much the drop shadow blurs.
TIP
When you use a blur filter, using values for blurX and blurY that are powers of two
(such as 2, 4, 8, 16, and 32) can be computed faster and give a 20% to 30%
performance improvement.
CAUTION
Setting a blur value lower than 1.03125 disables the blur effect.