Flash as filter effect Summary

Source: Internet
Author: User

Use as 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 folder.

1. Gradient angle-gradientbevelfilter class

Ii. Projection-dropshadowfilter class

Iii. Fuzzy -- blurfilter class (this is the easiest, with few parameters)

Iv. Glow-glowfilter

5. Gradient light-gradientglowfilter

6. bevelfilter

I only know the six

The method is to use the new keyword to create an object of the corresponding class. For now, it is called myfilters. Then, add this object to an array filters_array, and assign this array to the fliters attribute of MC, success.

I think the key should be how to set the parameters when creating an object. I think everyone is familiar with the filter panel. So, I compared some parameters for adding filters to as with their panels, which may be easier to understand.

The following is an example one by one (all in the Help example, the parameter names can be changed, but I think it would be nice to use those names ), in this example, setupflatrectangle (also called createrectangle) is used as 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 scenario. Do not forget the above function.

1. Gradient angle-gradientbevelfilter class

Panel: No, it's just the filter panel. You guys, please open the flash for reference.

Script:

Import flash. Filters. gradientbevelfilter;
Import flash. Filters. bitmapfilter;
VaR Art: movieclip = setupflatrectangle (150,150, 0 xcccccc, "gradientbevelfilterexample ");
// Create a new MC with the instance name: Art
VaR distance: Number = 5;
VaR angleindegrees: Number = 225; // opposite 45 degrees
VaR colors: array = [0 xffffff, 0 xcccccc, 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; // you can specify parameters.
VaR filter: gradientbevelfilter = new gradientbevelfilter (distance, angleindegrees, colors, Alphas, ratios, blurx, blury, strength, quality, type, Knockout); // create an angle filter object.
VaR filterarray: array = new array ();
Filterarray. Push (filter); // Add the filter to the array filterarray. If there are multiple filters on the art, add them directly to the array.
Art. Filters = filterarray; // set the filters attribute of art to filterarray

The following is a comparison between the parameters in the script and those in the panel:

Colors, Alphas, and ratios are used to control gradient colors. colors are colors and Alphas are percentages (0 ~ 1 decimal), ratios is offset 0 ~ 255 (refer to the color class) blurx and blury are the fuzzy X and fuzzy y corresponding to the Panel. Strength is the intensity in the panel, which is 0 ~ 255 of the number; quality is the quality, only 1, 2, 3 correspond to low, medium, high
Distance is the distance. The default value is 4.0. type is the type, which is represented by a string. In this example, "inner" is the inner, and there are outer and Fuller. Knockout is a Boolean value, indicating whether to empty the data.

Ii. Projection-dropshadowfilter class

Panel: No, it's just the filter panel. You guys, please open the flash for reference.

Script:

Import flash. Filters. dropshadowfilter;
VaR Art: movieclip = createrectangle (100,100, 0x003366, "gradientglowfilterexample ");
VaR distance: Number = 20;
VaR angleindegrees: Number = 45;
VaR color: Number = 0x000000;
Varalpha: 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;

The following is a comparison between the parameters in the script and those in the panel:

Distance is the distance;
Angleindegrees is angle 0 ~ 360
Blurx and blury are fuzzy X and fuzzy y
Strength is the intensity, and the script is 0 ~ Number of 5
Quality is the quality, which can only be 1, 2, and 3, respectively corresponding to low, medium, and high
Inner is the inner shadow.
Knockout is empty
Hideobject is a hidden object.

Iii. Fuzzy -- blurfilter class (this is the easiest, with few parameters)

Panel: No, it's just the filter panel. You guys, please open the flash for reference.

Script:

Import flash. Filters. blurfilter;
VaR rect: movieclip = createrectangle (100,100, 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 will not be explained. We have discussed the three parameters. We will not discuss the following parameters.

Iv. Glow-glowfilter

Panel: No, it's just the filter panel. You guys, please open the flash for reference.

Script:

Import flash. Filters. glowfilter;
VaR rect: movieclip = createrectangle (100,100, 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;

5. Gradient light-gradientglowfilter

Panel: No, it's just the filter panel. You guys, please open the flash for reference.

Script:

Import flash. Filters. gradientglowfilter;
VaR Art: movieclip = createrectangle (100,100, 0x003366, "gradientglowfilterexample ");
VaR distance: Number = 0;
VaR angleindegrees: Number = 45;
VaR colors: array = [0 xffffff, 0xff0000, 0xffff00, 0x00ccff];
VaR Alphas: array = [0, 1, 1, 1, 1];
Varratios: 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, strength, quality, type, Knockout );
VaR filterarray: array = new array ();
Filterarray. Push (filter );
Art. Filters = filterarray;

The parameters here are very similar to the ones that emit light. It should be noted that the four items in the arrays used to set the color indicate the color from the outside to the inside.

6. bevelfilter

Panel: No, it's just the filter panel. You guys, please open the flash for reference.

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 (100,100, 0x00cc00, "bevelfilterexample ");
Rect. Filters = new array (filter );

Parameters:

Set highlight color for highlightcolor and highlightalpha
Set shadowcolor and shadowalpha

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.