ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > BlurFilter (flash.filters.BlurFilter) > BlurFilter constructor | |||
Initializes the filter with the specified parameters. The default values create a soft, unfocused image.
Availability: ActionScript 1.0; Flash Player 8
blurX:Number [optional] - The amount to blur horizontally. Valid values are from 0 to 255 (floating-point value). The default value is 4. Values that are a power of 2 (such as 2, 4, 8, 16 and 32) are optimized to render more quickly than other values.
blurY:Number [optional] - The amount to blur vertically. Valid values are from 0 to 255 (floating-point value). The default value is 4. Values that are a power of 2 (such as 2, 4, 8, 16 and 32) are optimized to render more quickly than other values.
quality:Number [optional] - The number of times to apply the filter. The default value is 1, which is equivalent to low quality. A value of 2 is medium quality, and a value of 3 is high quality and approximates a Gaussian blur.
The following example instantiates a new BlurFilter constructor and applies it to a flat, rectangular shape:
import flash.filters.BlurFilter;
var rect:MovieClip = createRectangle(100, 100, 0x003366, "BlurFilterExample");
var blurX:Number = 30;
var blurY:Number = 30;
var quality:Number = 3;
var filter:BlurFilter = new BlurFilter(blurX, blurY, quality);
var filterArray:Array = new Array();
filterArray.push(filter);
rect.filters = filterArray;
function createRectangle(w:Number, h:Number, bgColor:Number, name:String):MovieClip {
var mc:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
mc.beginFill(bgColor);
mc.lineTo(w, 0);
mc.lineTo(w, h);
mc.lineTo(0, h);
mc.lineTo(0, 0);
mc._x = 20;
mc._y = 20;
return mc;
}
|
|
|
|