Google Search

Friday, October 7, 2011

program for Filling a shape with a Gradient


 Filling a shape with a Gradient


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);

0 comments:

Post a Comment