About blending modes
537
This code example consists of five logical sections. The first section imports the necessary
classes for the example. The second block of code creates a nested movie clip and loads a
JPEG image from a remote server. The third block of code creates a new BitmapData
instance named
perlinBmp
, which is the same size as the dimensions of the Stage. The
perlinBmp
instance contains the results of a Perlin noise effect, and is used later as a
parameter for the displacement map filter. The fourth block of code creates and applies
the displacement map filter effect to the dynamically loaded image created earlier. The
fifth, and final, block of code creates a listener for the mouse that regenerates the Perlin
noise that the displacement map filter uses whenever the user moves the mouse pointer.
3.
Select Control > Test Movie to test the Flash document.
About blending modes
You can apply blend modes to movie clip objects by using the Flash workspace (Flash
Professional 8) or ActionScript (Flash Basic 8 and Flash Professional 8). At runtime, multiple
graphics are merged as one shape. For this reason, you cannot apply different blend modes to
different graphic symbols.
For more information on using ActionScript to apply blend modes, see
“Applying blending
modes” on page 538
.
Blend modes involve combining the colors of one image (the base image) with the colors of
another image (the blend image) to produce a third image. Each pixel value in an image is
processed with the corresponding pixel value of the other image to produce a pixel value for
that same position in the result.
The
MovieClip.blendMode
property supports the following blend modes:
add
Commonly used to create an animated lightening dissolve effect between two images.
alpha
Commonly used to apply the transparency of the foreground on the background.
darken
Commonly used to superimpose type.
difference
Commonly used to create more vibrant colors.
erase
Commonly used to
cut out
(erase) part of the background using the foreground alpha.
hardlight
Commonly used to create shading effects.
invert
Used to invert the background.
layer
Used to force the creation of a temporary buffer for precomposition for a particular
movie clip.
lighten
Commonly used to superimpose type.
multiply
Commonly used to create shadows and depth effects.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...