A SERVICE OF

logo

Macromedia MAX 2005 - Anaheim, CA What’s New In Flash 8
113
The slice-9 guides appear.
2. Move the pointer over any of the four guides in the workspace to change the pointer to the
horizontal or vertical guide pointers that indicate that a drag operation will move the position
of the guide. Drag and release the pointer.
The new position of the guide is updated in the library preview for the symbol.
Using ActionScript to Modify Bitmaps
Creating Bitmaps with the BitmapData Class
The BitmapData class lets you create arbitrarily sized transparent or opaque bitmap images, then
manipulate them in various ways at runtime. When you manipulate a BitmapData instance directly
by using ActionScript, you can create very complex images without incurring the overhead of
constantly redrawing the content from vector data in Flash Player. The methods of the BitmapData
class support a variety of effects that are not available through the Filters tab in the Flash
workspace.
A BitmapData object contains an array of pixel data. This data either can represent a fully opaque
bitmap or a transparent bitmap that contains alpha channel data. Either type of BitmapData object is
stored as a buffer of 32-bit integers. Each 32-bit integer determines the properties of a single pixel in
the bitmap. Each 32-bit integer is a combination of four 8-bit channel values (from 0 to 255) that
describe the alpha transparency and the red, green, and blue (ARGB) values of the pixel.
You can find a sample source file that uses the BitmapData class to manipulate an image. Find the
file called BitmapData.fla in the Samples folder on your hard disk.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\BitmapData.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples and
Tutorials/Samples/ActionScript/BitmapData.
The following procedure dynamically loads a JPEG image onto the Stage, and uses the BitmapData
class to create a noise effect, similar to static on a television. The noise effect is redrawn with a
random pattern every 100 milliseconds (1/10 of a second). Moving the mouse pointer along the x-
axis and y-axis affects how much static is drawn at every interval.
To create a noise effect with the BitmapData class:
1. Create a new Flash document and save it as noise.fla.
2. Add the following ActionScript to Frame 1 of the Timeline: