package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.filters.DropShadowFilter;
public class FilterExample extends Sprite
{
public function FilterExample()
{
var bitmapData:BitmapData=new BitmapData(200,200,false,0xFF009900);
var displayobject:Bitmap=new Bitmap(bitmapData);
addChild(displayobject);
displayobject.x=130;
displayobject.y=80;
var dropShadow:DropShadowFilter=new DropShadowFilter();
var filtersArray:Array=new Array(dropShadow);
displayobject.filters=filtersArray;
}
}
}
Flash AS3位图滤镜浮雕效果
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
import flash.display.Sprite;
import flash.filters.GradientBevelFilter;
public class filterExample extends Sprite
{
public function filterExample()
{
//创建bitmapData对象并将它呈现在屏幕上
var bitmapData:BitmapData=new BitmapData(200,200,false,0xFF009900);
var displayobject:Bitmap=new Bitmap(bitmapData);
addChild(displayobject);
//设置位置
displayobject.x=130;
displayobject.y=80;
//创建滤镜实例
var bgColor:uint=0xcccccc;
var size:uint=80;
var offset:uint=50;
var distance:Number=5;
var angleInDegress:Number=225;
var colors:Array=[0xffffff,0xcccccc,0x000000];
var alphas:Array=[1,0,1];
var ratios:Array=[0,128,255];
var blurX:Number=8;
var blurY:Number=8;
var strength:Number=2;
var quality:Number=BitmapFilterQuality.HIGH;
var type:String=BitmapFilterType.INNER;
var knockout:Boolean=true;
var gradientBevelFilter:GradientBevelFilter=new GradientBevelFilter(distance,angleInDegress,colors,alphas,ratios,blurX,blurY,strength,quality,type,knockout);
//创建滤镜数组,通过将滤镜作为参数传递给Array()构造函数,
//将该滤镜添加到数组中
var filtersArray:Array=new Array(gradientBevelFilter);
//
displayobject.filters=filtersArray;
}
}
}
Flash AS3位图滤镜渐变发光效果
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
import flash.display.Sprite;
import flash.filters.GradientGlowFilter;
public class FilterExample extends Sprite
{
public function FilterExample()
{
//创建bitmapData对象并将它呈现在屏幕上
var bitmapData:BitmapData=new BitmapData(200,200,false,0x0000FF);
var displayobject:Bitmap=new Bitmap(bitmapData);
addChild(displayobject);
//设置位置
displayobject.x=130;
displayobject.y=80;
//创建滤镜实例
var distance:Number=0;
var angleInDegress:Number=45;
var colors:Array=[0xffffff,0xff0000,0xffff00,0x0000ff];
var alphas:Array=[0,1,1,1];
var ratios:Array=[0,63,126,255];
var blurX:Number=50;
var blurY:Number=50;
var strength:Number=3.5;
var quality:Number=BitmapFilterQuality.HIGH;
var type:String=BitmapFilterType.OUTER;
var knockout:Boolean=true;
var gradientBevelFilter:GradientGlowFilter=new GradientGlowFilter(distance,angleInDegress,colors,alphas,ratios,blurX,blurY,strength,quality,type,knockout);
//创建滤镜数组,通过将滤镜作为参数传递给Array()构造函数,
//将该滤镜添加到数组中
var filtersArray:Array=new Array(gradientBevelFilter);
//
displayobject.filters=filtersArray;
}
}
}
Flash AS3位图滤镜模糊效果
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
import flash.display.Sprite;
import flash.filters.GradientGlowFilter;
import flash.filters.BlurFilter;
public class FilterExample extends Sprite
{
public function FilterExample()
{
//创建bitmapData对象并将它呈现在屏幕上
var bitmapData:BitmapData=new BitmapData(200,200,false,0x0000FF);
var displayobject:Bitmap=new Bitmap(bitmapData);
addChild(displayobject);
//设置位置
displayobject.x=130;
displayobject.y=80;
//创建滤镜实例
var blurX:Number=30;
var blurY:Number=30;
var gradientBevelFilter:BlurFilter=new BlurFilter(blurX,blurY,BitmapFilterQuality.HIGH);
//创建滤镜数组,通过将滤镜作为参数传递给Array()构造函数,
//将该滤镜添加到数组中
var filtersArray:Array=new Array(gradientBevelFilter);
//
displayobject.filters=filtersArray;
}
}
}
Flash AS3位图滤镜发光效果
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.filters.GlowFilter;
public class FilterExample extends Sprite
{
public function FilterExample()
{
//创建bitmapData对象并将它呈现在屏幕上
var bitmapData:BitmapData=new BitmapData(200,200,false,0xFF009900);
var displayobject:Bitmap=new Bitmap(bitmapData);
addChild(displayobject);
//设置位置
displayobject.x=130;
displayobject.y=80;
//创建滤镜实例
var glowFilter:GlowFilter=new GlowFilter(0x0000FF);
//创建滤镜数组,通过将滤镜作为参数传递给Array()构造函数,
//将该滤镜添加到数组中
var filtersArray:Array=new Array(glowFilter);
//将滤镜数组分配给显示对象以便应用滤镜
displayobject.filters=filtersArray;
}
}
}