ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > DropShadowFilter (flash.filters.DropShadowFilter) > DropShadowFilter constructor | |||
public DropShadowFilter([distance:Number], [angle:Number], [color:Number], [alpha:Number], [blurX:Number], [blurY:Number], [strength:Number], [quality:Number], [inner:Boolean], [knockout:Boolean], [hideObject:Boolean])
Creates a new DropShadowFilter instance with the specified parameters.
Availability: ActionScript 1.0; Flash Player 8
distance:Number [optional] - The offset distance for the shadow, in pixels. The default value is 4 (floating point).
angle:Number [optional] - The angle of the shadow, 0 to 360˚ (floating point). The default value is 45.
color:Number [optional] - The color of the shadow, in hexadecimal format 0xRRGGBB. The default value is 0x000000.
alpha:Number [optional] - The alpha transparency value for the shadow color. Valid values are 0 to 1. For example, 0.25 sets a transparency value of 25%. The default value is 1.
blurX:Number [optional] - The amount of horizontal blur. Valid values are 0 to 255 (floating point). 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 of vertical blur. Valid values are 0 to 255 (floating point). 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.
strength:Number [optional] - The strength of the imprint or spread. The higher the value, the more color is imprinted and the stronger the contrast between the shadow and the background. Valid values are 0 to 255. The default is 1.
quality:Number [optional] - The number of times to apply the filter. Valid values are 0 to 15. 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.
inner:Boolean [optional] - Indicates whether or not the shadow is an inner shadow. A value of true specifies an inner shadow. The default is false, an outer shadow (a shadow around the outer edges of the object).
knockout:Boolean [optional] - Applies a knockout effect (true), which effectively makes the object's fill transparent and reveals the background color of the document. The default is false (no knockout).
hideObject:Boolean [optional] - Indicates whether or not the object is hidden. A value of true indicates that the object itself is not drawn; only the shadow is visible. The default is false (show the object).
The following example instantiates a new DropShadowFilter instance and applies it to a flat, rectangular shape.
import flash.filters.DropShadowFilter;
var art:MovieClip = createRectangle(100, 100, 0x003366, "gradientGlowFilterExample");
var distance:Number = 20;
var angleInDegrees:Number = 45;
var color:Number = 0x000000;
var alpha:Number = 0.8;
var blurX:Number = 16;
var blurY:Number = 16;
var strength:Number = 1;
var quality:Number = 3;
var inner:Boolean = false;
var knockout:Boolean = false;
var hideObject:Boolean = false;
var filter:DropShadowFilter = new DropShadowFilter(distance,
angleInDegrees,
color,
alpha,
blurX,
blurY,
strength,
quality,
inner,
knockout,
hideObject);
var filterArray:Array = new Array();
filterArray.push(filter);
art.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;
}
|
|
|
|