The DropShadowFilter ClassThe DropShadowFilter class is designed to create drop shadows on objects at runtime. It is important that when using this class to import it first at the beginning of your script, like this: import flash.filters.DropShadowFilter; To instantiate a new instance of the DropShadowFilter class, use this code as a template:
Example: This example will create a small blue square using the drawing API and apply the filter to it: import flash.filters.DropShadowFilter; //create the movie clip to display the filter var rec_mc:MovieClip = this.createEmptyMovieClip("rec_mc", 1); //move the rectangle towards the center of the stage rec_mc._x = rec_mc._y = 200; //draw a squar inside the movie clip rec_mc.lineStyle(0,0x000000,0); rec_mc.beginFill(0x397dce, 100); rec_mc.lineTo(100,0); rec_mc.lineTo(100,100); rec_mc.lineTo(0,100); rec_mc.lineTo(0,0); rec_mc.endFill(); //create the filter var myFilter:DropShadowFilter = new DropShadowFilter (10, 45, 0x000033, 50, 10, 10, 2, 3); //apply the filter rec_mc.filters = new Array(myFilter); Because the properties of this object match the parameters identically, they will be skipped. MethodscloneAvailability: FP:8, AS:1.0 Generic Template: myFilter.clone() Returns: DropShadowFilter An exact copy of the DropShadowFilter will be returned. Description: This method will create a duplicate copy of the DropShadowFilter it is called on. Example: This example will create a filter, clone it, then walk through all the properties to see that they match: import flash.filters.DropShadowFilter; //create the filter var myFilter:DropShadowFilter = new DropShadowFilter (10, 45, 0x000033, 50, 10, 10, 2, 3); //apply the filter img_mc.filters = new Array(myFilter); //create a copy var myNewFilter:DropShadowFilter = myFilter.clone(); //walk through and display each property for(each in myNewFilter){ trace(each + ": " + myNewFilter[each]); } //output:clone: [type Function] //hideObject: false //strength: 2 //blurY: 10 //blurX: 10 //knockout: false //inner: false //quality: 3 //alpha: 1 //color: 51 //angle: 45 //distance: 10 |