Filter
With as as the filter effect, each filter effect corresponds to a class, these classes are in the Macromedia\flash 8 Beta 2\zh_cn\first run\classes\fp8\flash\filters This folder
One, gradient bevel--gradientbevelfilter class
Second, projection--dropshadowfilter class
Three, the Fuzzy--blurfilter class (this easiest, the parameter is few)
Four, light-emitting--glowfilter class
V, gradient light-emitting--gradientglowfilter class
Hexagon--bevelfilter type of bevel
All I know for a while is these 6.
The approach is to use the New keyword to create a corresponding class object, temporarily called Myfilters Bar, and then add this object into an array filters_array, and finally the array to assign value to the Fliters properties of the MC, finished.
I think the key should be how to set the parameters inside the object, I think the filter is very familiar with the panel, then I will add some of the filters as the parameters and their panels, which may be easier to understand.
Below one by one example (all is the example of Help, the parameters in the name can be changed, but I think that the name on the good), examples have functions setupflatrectangle (also called Createrectangle), is used to do a square MC.
function Setupflatrectangle (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);
return MC;
}
Copy the script directly to the first frame of the main scene OK, do not forget the above function oh, pay attention to change the function name of the
One, gradient bevel--gradientbevelfilter class
Panel: Screenshot is no, is the cut of the filter panel, you Big Brother please open Flash control yourself
Script:
Import Flash.filters.GradientBevelFilter;
Import Flash.filters.BitmapFilter;
var art:movieclip = Setupflatrectangle (0xCCCCCC, "gradientbevelfilterexample");
Create a new MC, instance name: Art
var distance:number = 5;
var angleindegrees:number = 225; Opposite degrees
var colors:array = [0xFFFFFF, 0xCCCCCC, 0x000000];
var alphas:array = [1, 0, 1];
var ratios:array = [0, 128, 255];
var blurx:number = 8;
var blury:number = 8;
var strength:number = 2;
var quality:number = 3;
var type:string = "inner";
var Knockout:boolean = true;//Set Individual parameters
var filter:gradientbevelfilter = new Gradientbevelfilter (distance, angleindegrees, colors, alphas, ratios, BlurX, Blury, Strength, quality, type, knockout);//Create Bevel Filter Object filter
var filterarray:array = new Array ();
Filterarray.push (filter); Add filter to array filterarray, if art has more than one filter effect, add it directly into the array.
Art.filters = filterarray;//Sets the filters property of art to Filterarray
The following are the parameters in the script and the comparison of the parameters in the panel:
Colors, Alphas, ratios to control the gradient color, colors is the color, the Alphas is the percentage (this is the 0~1 decimal), ratios is the offset 0~255 (you can refer to the color Class) BlurX, Blury is the fuzzy x, fuzzy y in the corresponding panel. Strength is the strength of the panel, is the number of 0~255, quality is the quality, only 1, 2, 3 respectively corresponding to low, medium and high
The distance is the distance, the default 4.0;type is the type, the string representation, the "inner" in the example is the inside, and the outer, Fuller;knockout is a Boolean value that indicates whether the knockout.
Second, projection--dropshadowfilter class
Panel: Screenshot is no, is the cut of the filter panel, you Big Brother please open Flash control yourself
Script:
Import Flash.filters.DropShadowFilter;
var art:movieclip = Createrectangle (+, 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, qualit Y, Inner, Knockout, hideobject);
var filterarray:array = new Array ();
Filterarray.push (filter);
Art.filters = Filterarray;
The following are the parameters in the script and the comparison of the parameters in the panel:
Distance is the distance;
angleInDegrees is the angle 0~360
BlurX, Blury is fuzzy x, fuzzy y
Strength is the strength, the script is the number of 0~5
Quality is a quality, only 1, 2, 3, respectively, corresponding to low, medium and high
Inner is the medial shadow.
Knockout is a knockout.
Hideobject is a hidden object
three, Fuzzy--blurfilter class (This is the easiest, less parameters)
Panel: Screenshot is no, is the cut of the filter panel, you Big Brother please open Flash control yourself
Script:
Import Flash.filters.BlurFilter;
var rect:movieclip = Createrectangle (+, 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;
This is not explained, the three parameters, described above, the following encountered the introduction of the parameters are not introduced
Four, light-emitting--glowfilter class
Panel: Screenshot is no, is the cut of the filter panel, you Big Brother please open Flash control yourself
Script:
Import Flash.filters.GlowFilter;
var rect:movieclip = Createrectangle (+, 0x003366, "gradientglowfilterexample");
var color:number = 0X33CCFF;
var alpha:number =. 8;
var blurx:number = 35;
var blury:number = 35;
var strength:number = 2;
var quality:number = 3;
var Inner:boolean = false;
var Knockout:boolean = false;
var filter:glowfilter = new Glowfilter (color, alpha, BlurX, Blury, strength, quality, inner, knockout);
var filterarray:array = new Array ();
Filterarray.push (filter);
Rect.filters = Filterarray;
V, gradient light-emitting--gradientglowfilter class
Panel: Screenshot is no, is the cut of the filter panel, you Big Brother please open Flash control yourself
Script:
Import Flash.filters.GradientGlowFilter;
var art:movieclip = Createrectangle (+, 0x003366, "gradientglowfilterexample");
var distance:number = 0;
var angleindegrees:number = 45;
var colors:array = [0xFFFFFF, 0xff0000, 0xffff00, 0X00CCFF];
var alphas:array = [0, 1, 1, 1, 1];
var ratios:array = [0, 63, 126, 255];
var blurx:number = 50;
var blury:number = 50;
var strength:number = 2.5;
var quality:number = 3;
var type:string = "outer";
var Knockout:boolean = false;
var filter:gradientglowfilter = new Gradientglowfilter (distance, angleindegrees, colors, alphas, ratios, BlurX, Blury, St Rength, quality, type, knockout);
var filterarray:array = new Array ();
Filterarray.push (filter);
Art.filters = Filterarray;
The parameters here are similar to the glowing one, which is to say that the 4 items in the array that are used to set the color are in turn the color from the outside to the
hexagon--bevelfilter type of bevel
Panel: Screenshot is no, is the cut of the filter panel, you Big Brother please open Flash control yourself
Script:
Import Flash.filters.BevelFilter;
var distance:number = 5;
var angleindegrees:number = 45;
var highlightcolor:number = 0xffff00;
var highlightalpha:number = 1;
var shadowcolor:number = 0x0000ff;
var shadowalpha:number = 1;
var blurx:number = 10;
var blury:number = 10;
var strength:number = 2;
var quality:number = 3;
var type:string = "inner";
var Knockout:boolean = false;
var filter:bevelfilter = new Bevelfilter (distance, angleindegrees, HighlightColor, Highlightalpha, Shadowcolor, Shadowalpha, BlurX, Blury, strength, quality, type, knockout);
var rect:movieclip = Createrectangle (+, 0x00cc00, "bevelfilterexample");
Rect.filters = new Array (filter);
Parameters:
HighlightColor, highlightalpha settings Highlight Colors
Shadowcolor, Shadowalpha set shadow color