以下示例将绘制一个灰色正方形,并对它应用 BevelFilter 对象。该示例使用常数
BitmapFilterQuality.HIGH
设置
quality
属性。
package {
import flash.display.Sprite;
import flash.filters.BevelFilter;
import flash.filters.BitmapFilter;
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
public class BitmapFilterQualityExample extends Sprite {
private var bgColor:uint = 0x999999;
private var size:uint = 80;
private var offset:uint = 50;
public function BitmapFilterQualityExample() {
draw();
var filter:BitmapFilter = getBitmapFilter();
var myFilters:Array = new Array();
myFilters.push(filter);
filters = myFilters;
}
private function getBitmapFilter():BitmapFilter {
var distance:Number = 5;
var angleInDegrees:Number = 45;
var highlightColor:Number = 0xCCCCCC;
var highlightAlpha:Number = 0.8;
var shadowColor:Number = 0x808080;
var shadowAlpha:Number = 0.8;
var blurX:Number = 5;
var blurY:Number = 5;
var strength:Number = 5;
var quality:Number = BitmapFilterQuality.HIGH;
var type:String = BitmapFilterType.INNER;
var knockout:Boolean = false;
return new BevelFilter(distance,
angleInDegrees,
highlightColor,
highlightAlpha,
shadowColor,
shadowAlpha,
blurX,
blurY,
strength,
quality,
type,
knockout);
}
private function draw():void {
graphics.beginFill(bgColor);
graphics.drawRect(offset, offset, size, size);
graphics.endFill();
}
}
}