flash.filters

# BitmapFilter - AS3

Package | flash.filters
Class | public class BitmapFilter
Inheritance | BitmapFilter Object
Subclasses | BevelFilter, BlurFilter, ColorMatrixFilter, ConvolutionFilter, DisplacementMapFilter, DropShadowFilter, GlowFilter, GradientBevelFilter, GradientGlowFilter, ShaderFilter

Language Version: | ActionScript 3.0

Runtime Versions: | AIR 1.0, Flash Player 9

The BitmapFilter class is the base class for all image filter effects.

The BevelFilter, BlurFilter, ColorMatrixFilter, ConvolutionFilter, DisplacementMapFilter, DropShadowFilter, GlowFilter, GradientBevelFilter, and GradientGlowFilter classes all extend the BitmapFilter class. You can apply these filter effects to any display object.

You can neither directly instantiate nor extend BitmapFilter.

View the examples

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | clone():BitmapFilter Returns a BitmapFilter object that is an exact copy of the original BitmapFilter object. | BitmapFilter
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Method Detail

### clone

()
method

`public function clone():BitmapFilter`

Language Version: | ActionScript 3.0

Runtime Versions: | AIR 1.0, Flash Player 9

Returns a BitmapFilter object that is an exact copy of the original BitmapFilter object.

Returns

| `BitmapFilter` — A BitmapFilter object.

Examples How to use this example
BitmapFilterExample.as
The following example shows how several filters may be applied to a given DisplayObject object and tracked using the `filters` property.
Copy

    package {
        import flash.display.Sprite;
        import flash.filters.*;

        public class BitmapFilterExample extends Sprite {
            public function BitmapFilterExample() {
                trace(this.filters.length);             // 0

                var tmpFilters:Array = this.filters;
                tmpFilters.push(FilterFactory.createFilter(FilterFactory.BEVEL_FILTER));
                tmpFilters.push(FilterFactory.createFilter(FilterFactory.GLOW_FILTER));
                this.filters = tmpFilters;

                trace(this.filters.length);             // 2
                trace(this.filters[0] is BitmapFilter); // true
                trace(this.filters[0] is BevelFilter);  // true
                trace(this.filters[1] is BitmapFilter); // true
                trace(this.filters[1] is GlowFilter);   // true
            }
        }
    }

    import flash.filters.*;
    class FilterFactory {
        public static var BEVEL_FILTER:String = "BevelFilter";
        public static var BevelFilterConstructor:Class = BevelFilter;

        public static var BLUR_FILTER:String = "BlurFilter";
        public static var BlurFilterConstructor:Class = BlurFilter;

        public static var COLOR_MATRIX_FILTER:String = "ColorMatrixFilter";
        public static var ColorMatrixFilterConstructor:Class = ColorMatrixFilter;

        public static var CONVOLUTION_FILTER:String = "ConvolutionFilter";
        public static var ConvolutionFilterConstructor:Class = ConvolutionFilter;

        public static var DISPLACEMENT_MAP_FILTER:String = "DisplacementMapFilter";
        public static var DisplacementMapFilterConstructor:Class = DisplacementMapFilter;

        public static var DROP_SHADOW_FILTER:String = "DropShadowFilter";
        public static var DropShadowFilterConstructor:Class = DropShadowFilter;

        public static var GLOW_FILTER:String = "GlowFilter";
        public static var GlowFilterConstructor:Class = GlowFilter;

        public static var GRADIENT_BEVEL_FILTER:String = "GradientBevelFilter";
        public static var GradientBevelFilterConstructor:Class = GradientBevelFilter;

        public static var GRADIENT_GLOW_FILTER:String = "GradientGlowFilter";
        public static var GradientGlowFilterConstructor:Class = GradientGlowFilter;

        public static function createFilter(type:String):BitmapFilter {
            return new FilterFactory[type + "Constructor"]();
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00