13. Filling a Shape with a Gradient
Procedure:
step 1: Open flash 8
step 2: Select flash document
step 3: select 1st layer, 1st frame on that document and write source code on Actions Frame
step 4: To check output press ctrl+enter(test movie)
Source code:
import flash.filters.GradientGlowFilter;
var shape:MovieClip=this.createEmptyMovieClip("shape",10);
with(shape)
{
beginFill(0xFF0000,100);
moveTo(0,0);
lineTo(100,0);
lineTo(100,100);
lineTo(0,100);
lineTo(0,0);
endFill();
}
shape._x=100;
shape._y=100;
var g:GradientGlowFilter=new GradientGlowFilter(0,45,[0x000000,0xFF0000],[0,1],
[0,255],10,10,2,3,"outer");
var mouseListener:Object=new Object();
mouseListener.onMouseDown=function():Void
{
g.strength++;
shape.filters=[g];
};
mouseListener.onMouseMove=function():Void
{
g.blurX=(_xmouse/Stage.width)*255;
g.blurY=(_ymouse/Stage.height)*255;
shape.filters=[g];
};
Mouse.addListener(mouseListener);
No comments:
Post a Comment