EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 845

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
MovieClip 845
Example
The following example sets up two movie clips with gradient fills, and changes the blend
mode of the one in the foreground every second. In order to have the
"alpha" blend mode
show up with an effect, the gradient for the
mc2 movie clip includes a range of alpha ratios,
and the
"layer" blend mode is applied to the parent movie clip
(
this.blendMode="layer").
this.createEmptyMovieClip("mc1", this.getNextHighestDepth());
this.createEmptyMovieClip("mc2", this.getNextHighestDepth());
this.blendMode="layer";
this.createTextField("blendLabel", this.getNextHighestDepth(), 50, 150,
100, 100)
fillClip(mc1, 0x00AA00, 0x22FFFF, 100, 100)
fillClip(mc2, 0xFF0000, 0x2211FF, 100, 50)
mc2._x = 33;
mc2._y = 33;
var blendModeIndex = 0;
setInterval(changeBlendMode, 1000);
function changeBlendMode()
{
mc2.blendMode = blendModeIndex % 14 + 1 ;
// values 1 - 14
blendLabel.text = (blendModeIndex% 14 + 1) + ": " + mc2.blendMode;
blendModeIndex++;
}
function fillClip(mc:MovieClip, color1:Number, color2:Number,
alpha1:Number, alpha2: Number)
{
matrix = {a:100, b:0, c:0, d:0, e:100, f:0, g:50, h:20, i:1};
mc.beginGradientFill("linear", [color1, color2], [alpha1, alpha2], [0,
0xFF], matrix);
mc.lineStyle(8,0x888888,100)
mc.moveTo(0, 0);
mc.lineTo(0, 100);
mc.lineTo(100, 100);
mc.lineTo(100, 0);
mc.lineTo(0, 0);
mc.endFill();
}
If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth() method, which is
used in the previous example.

Table of Contents

Related product manuals