O'Reilly logo

ActionScript 3.0 Bible by Roger Braunstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 37. Applying Filters

FEATURED CLASSES

  • flash.filters.BitmapFilter

  • flash.filters.*

With ActionScript 3.0, you can easily apply one or a combination of preset graphical styles to any display object. Perhaps you'd like to blur an image, create a beveled edge, or add a glow to a Sprite, or maybe you want to distort an image. Like bitmap image-editing programs such as Photoshop, these treatments are made available as filters. In the Flash Player API, subclasses of the flash.filters.BitmapFilter class represent filters you can use to style display objects at runtime.

Introducing Filters

Filters are built-in effects you can apply to any DisplayObject, like Sprite, MovieClip, or TextField. All the filters discussed in this chapter are built into the Flash Player runtime, which makes them fast to render. Under the hood, when you apply a filter to a DisplayObject, Flash Player renders the display object as a bitmap and applies the filter to the bitmap to produce the desired graphical effect. Any time you apply a filter to a DisplayObject, its cacheAsBitmap property is set to true.

The filters available in Flash Player 9 and later are as follows:

  • BevelFilter

  • BlurFilter

  • ColorMatrixFilter

  • ConvolutionFilter

  • DisplacementMapFilter

  • DropShadowFilter

  • GlowFilter

  • GradientBevelFilter

  • GradientGlowFilter

Flash Player 10 adds the ShaderFilter, enabling you to use Pixel Bender shaders easily on display objects with the same interface as any of the built-in filters. You'll learn about Pixel Bender shaders in Chapter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required