O'Reilly logo

Learning ActionScript 3.0 by Zevan Rosser, Rich Shupe

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 9. DRAWING WITH PIXELS

While largely known for its focus on vector assets, Flash has been gaining attention in the field of manipulating pixel-based assets, as well. This began in earnest with the introduction of Flash 8, as a large new set of bitmap-related functionality was introduced. Included was a set of blend modes, basic filters (like drop shadow and bevel, akin to Photoshop layer styles), and advanced filter effects (like convolution and displacement mapping, akin to Photoshop filters). Even the ability to temporarily treat vectors like bitmaps, behind the scenes with no loss in vector quality, was introduced for a dramatic performance improvement.

Today, the speed increases afforded by ActionScript 3.0, in Flash Player 9 and later, make bitmap manipulation practical in more processor-intensive scenarios than ever before. In this chapter, we'll discuss several ways to add pixel-pushing to your projects, including:

  • Bitmap Caching. Moving pixels on screen is a lot more efficient than recalculating the math required to display moving vectors upon every frame rate. Temporarily caching a bitmap representation of a vector-based asset can reduce this strain and increase performance.

  • The BitmapData Class. Just as the Graphics class is used to draw with vectors, the BitmapData class can be used to draw with pixels. We'll look at a small subset of its most useful methods.

  • Blend Modes. Another useful and efficient bitmap compositing tool is the blend mode. Flash offers a standard ...

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