| Properties | Methods |
Object
| Player version: | Flash Player 8 |
The use of filters depends on the object to which you apply the filter:
filters property. Setting the filters property of an object does not modify the object and can be undone by clearing the filters property.BitmapData.applyFilter() method. Calling applyFilter() on a BitmapData object takes the source BitmapData object and the filter object and generates a filtered image as a result.You can also apply filter effects to images and video at authoring time. For more information, see your authoring documentation.
If you apply a filter to a movie clip or button, the cacheAsBitmap property of the movie clip or button is set to true. If you clear all filters, the original value of cacheAsBitmap is restored.
This filter supports Stage scaling. However, general scaling, rotation, and skewing are not supported. If the object itself is scaled (if _xscale and _yscale are not 100%), the filter effect is not scaled. It is scaled only when the Stage is zoomed in.
A filter is not applied if the resulting image exceeds 2880 pixels in width or height. For example, if you zoom in on a large movie clip with a filter applied, the filter is turned off if the resulting image exceeds the limit of 2880 pixels.
See also| MovieClip.filters, MovieClip.cacheAsBitmap, Button.filters, Button.cacheAsBitmap, TextField.filters, flash.display.BitmapData.applyFilter() |
| Property Summary | |
| alpha : Number
The alpha transparency value for the shadow color. |
| angle : Number
The angle of the shadow. |
| blurX : Number
The amount of horizontal blur. |
| blurY : Number
The amount of vertical blur. |
| color : Number
The color of the shadow. |
| distance : Number
The offset distance for the shadow, in pixels. |
| hideObject : Boolean
Indicates whether or not the object is hidden. |
| inner : Boolean
Indicates whether or not the shadow is an inner shadow. |
| knockout : Boolean
Applies a knockout effect ( true), which effectively makes the object's fill transparent and reveals the background color of the document. |
| quality : Number
The number of times to apply the filter. |
| strength : Number
The strength of the imprint or spread. |
| Properties inherited from class Object |
__proto__, __resolve, constructor, prototype |
| Constructor Summary | |
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. |
|
| Method Summary | |
| clone() : DropShadowFilter
Returns a copy of this filter object. |
| Methods inherited from class BitmapFilter |
clone |
| Methods inherited from class Object |
addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch |
| Property Detail |
public alpha : Number
| Player version: | Flash Player 8 |
alpha property on a movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowAlpha");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.alpha = .4;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public angle : Number
| Player version: | Flash Player 8 |
The angle value represents the angle of the theoretical light source falling on the object and determines the placement of the effect relative to the object. If distance is set to 0, the effect is not offset from the object, and therefore the angle property has no effect.
Exampleangle property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowAngle");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.angle = 135;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public blurX : Number
| Player version: | Flash Player 8 |
blurX property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowBlurX");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.blurX = 40;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public blurY : Number
| Player version: | Flash Player 8 |
blurY property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowBlurY");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.blurY = 40;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public color : Number
| Player version: | Flash Player 8 |
color property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowColor");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.color = 0xFF0000;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public distance : Number
| Player version: | Flash Player 8 |
distance property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowDistance");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.distance = 40;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public hideObject : Boolean
| Player version: | Flash Player 8 |
true indicates that the object itself is not drawn; only the shadow is visible. The default is false (show the object).
Example
hideObject property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowHideObject");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.hideObject = true;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public inner : Boolean
| Player version: | Flash Player 8 |
true indicates an inner shadow. The default is false, an outer shadow (a shadow around the outer edges of the object).
Example
inner property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowInner");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.inner = true;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public knockout : Boolean
| Player version: | Flash Player 8 |
true), which effectively makes the object's fill transparent and reveals the background color of the document. The default is false (no knockout).
Example
knockout property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowKnockout");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.knockout = true;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public quality : Number
| Player version: | Flash Player 8 |
For most applications, a quality value of 1, 2, or 3 is sufficient. Although you can use additional numeric values up to 15 to achieve different effects, higher values are rendered more slowly. Instead of increasing the value of quality, you can often get a similar effect, and with faster rendering, by simply increasing the values of blurX and blurY.
quality property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowQuality");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.quality = 0;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
public strength : Number
| Player version: | Flash Player 8 |
strength property on an existing movie clip when a user clicks it.
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle("DropShadowStrength");
mc.onRelease = function() {
var filter:DropShadowFilter = this.filters[0];
filter.strength = .6;
this.filters = new Array(filter);
}
function createDropShadowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var filter:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
| Constructor Detail |
public DropShadowFilter([distance:Number], [angle:Number], [color:Number], [alpha:Number], [blurX:Number], [blurY:Number], [strength:Number], [quality:Number], [inner:Boolean], [knockout:Boolean], [hideObject:Boolean])
| Player version: | 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, .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). |
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 = .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;
}
| Method Detail |
public clone() : DropShadowFilter
| Player version: | Flash Player 8 |
DropShadowFilter —
A new DropShadowFilter instance with all the properties of the original one.
|
filter_1 is created by using the DropShadowFilter constructor; filter_2 is created by setting it equal to filter_1; and clonedFilter is created by cloning filter_1. Notice that although filter_2 evaluates as being equal to filter_1, clonedFilter, even though it contains the same values as filter_1, does not.
import flash.filters.DropShadowFilter;
var filter_1:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false);
var filter_2:DropShadowFilter = filter_1;
var clonedFilter:DropShadowFilter = filter_1.clone();
trace(filter_1 == filter_2); // true
trace(filter_1 == clonedFilter); // false
for(var i in filter_1) {
trace(">> " + i + ": " + filter_1[i]);
// >> clone: [type Function]
// >> hideObject: false
// >> strength: 1
// >> blurY: 16
// >> blurX: 16
// >> knockout: false
// >> inner: false
// >> quality: 3
// >> alpha: 0.8
// >> color: 0
// >> angle: 45
// >> distance: 15
}
for(var i in clonedFilter) {
trace(">> " + i + ": " + clonedFilter[i]);
// >> clone: [type Function]
// >> hideObject: false
// >> strength: 1
// >> blurY: 16
// >> blurX: 16
// >> knockout: false
// >> inner: false
// >> quality: 3
// >> alpha: 0.8
// >> color: 0
// >> angle: 45
// >> distance: 15
}
filter_1, filter_2, and clonedFilter, the following example modifies the knockout property of filter_1. Modifying knockout demonstrates that the clone() method creates a new instance based on the values of filter_1 instead of pointing to them in reference. import flash.filters.DropShadowFilter; var filter_1:DropShadowFilter = new DropShadowFilter(15, 45, 0x000000, .8, 16, 16, 1, 3, false, false, false); var filter_2:DropShadowFilter = filter_1; var clonedFilter:DropShadowFilter = filter_1.clone(); trace(filter_1.knockout); // false trace(filter_2.knockout); // false trace(clonedFilter.knockout); // false filter_1.knockout = true; trace(filter_1.knockout); // true trace(filter_2.knockout); // true trace(clonedFilter.knockout); // false
| Properties | Methods |