Chapter 29. Applying Filters to Your Graphics

Introduction

In this chapter

  • Introducing filters

  • Applying a filter

  • Applying more than one filter

  • Rotating objects with filters

Want to add some Photoshop‐like effects to your DisplayObjects? Perhaps you'd like to create a photo blur, or create a beveled edge, or add a glow to a Sprite, or perhaps you want to distort an image. Whatever it is that you'd like to do, it's more than likely that if it can be done in Flash, you'll be doing it with some of the filters in the flash.filters package.

Filters are built‐in effects you can apply to any DisplayObject: Sprite, MovieClip, or TextField. The filters in Flash Player 9 are built into the player, and they use native bitmap functionality to create their effects; that means that the filters can render filters quickly. Under the hood of Flash Player, when you apply a filter to a DisplayObject, Flash Player renders a bitmap surface with the related effect. Any time you apply a filter to a DisplayObject, its cacheAsBitmap property is set to true. DisplayObjects that contain simple vector graphics can be cached simply as vectors to save resources in the player. However, once you apply a filter to a DisplayObject it is more efficient to save it as a bitmap.

The filters available in Flash Player 9 are as follows:

  • BevelFilter

  • BlurFilter

  • ColorMatrixFilter

  • ConvolutionFilter

  • DisplacementMapFilter

  • DropShadowFilter

  • GlowFilter

  • GradientBevelFilter

  • GradientGlowFilter

In this chapter, we look at each of the filters, and how ...

Get ActionScript™ 3.0 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.