A SERVICE OF

logo

Macromedia MAX 2005 - Anaheim, CA What’s New In Flash 8
116
shapeClip.filters = [displacementMap];
};
Mouse.addListener(mouseListener);
This code loads a JPEG image and places it on the Stage. After the image is completely
loaded, this code creates a BitmapData instance and uses the perlinNoise() method to fill it
with randomly placed pixels. The BitmapData instance passes to the displacement map filter,
which is applied to the image and causes the image to look distorted.
3. Select Control > Test Movie to test the document.
Move your mouse pointer around the Stage to re-create a displacement map by calling the
perlinNoise() method, which changes the appearance of the JPEG image.
Using the Convolution Filter
The ConvolutionFilter class applies a matrix convolution filter effect. A convolution combines pixels
in a source image that you specify with neighboring pixels to produce an image. You can achieve a
wide variety of imaging operations by using the convolution filter, which includes blurring, edge
detection, sharpening, embossing, and beveling effects.
NOTE: You can apply this filter on bitmaps and movie clip instances
A matrix convolution is based on an n x m matrix, which describes how a given pixel value in the
input image is combined with its neighboring pixel values to produce a resulting pixel value. Each
resulting pixel is determined by applying the matrix to the corresponding source pixel and its
neighboring pixels.
This filter is only available by using ActionScript.
The following procedure applies the convolution filter to a dynamically loaded JPEG image.