
Page 1 of 2 If you read Tom Green's article, "Getting Expressive with Flash 8 Professional," you learned about the new filters — Drop Shadow, Blur, Glow, etc. — that you can apply to movie clips and text at authoring time. In this article, you'll learn how to apply the new filters to movie clips and text fields at runtime using ActionScript. The result is the following movie (requires Flash Player 8):
You'll need to install the Public Beta of Flash Player 8 to see this movie.
Click here if you already have Flash Player installed.
Figure 1 The completed version of filter_demo.swf applies 7 different filters
NOTE: Outrageously cool werewolf, devils, and hockey player by Chris Flick. Photos from the CMX JumpStart: Vegas.
The engine behind the new effects in Flash 8 is a package of ActionScript classes called filters. Using this set of classes, you can apply effects such as blur and drop shadow to movie clips, bitmaps, and text at runtime. What makes this such a big deal for Flash developers is that we can apply these effects to dynamically loaded JPG, GIF, and PNG files, and animate these effects as well. Prior to Flash 8, the only way to achieve a realistic drop shadow was to import a transparent PNG into the library. Now drop shadows and other effects can be generated natively by Flash Player.
The following is a list of the new filter classes:
In the next section, we'll create a Flash movie that uses seven of these classes — the same seven filters available on the Filters tab of the Property inspector — to alter a text field and external images loaded at runtime. In future installments of this series, we'll explore the BitmapFilter, ConvolutionFilter, and DisplacementMapFilter classes.
Keywords
flash.filters package, BevelFilter, BlurFilter, ColorMatrixFilter, DropShadowFilter, GlowFilter, GradientBevelFilter, GradientGlowFilter, Flash 8, ActionScript 2.0