我不知道我可以创建AS3的调整颜色的筛选器。
I wonder how I can create an "Adjust Color"-filter in AS3.
我在Photoshop(8x8px)创建了一个红色的盒子,将其保存为PNG文件,然后我导入到Flash中。我转换的文件到MovieClip符号。我申请一个调整颜色的筛选器。有了,我可以很容易地改变颜色,但我想在AS3同样的效果。
I created a red box in Photoshop (8x8px), saved it as a PNG-file, then I imported it to Flash. I converted the file to a MovieClip-symbol. I applied an "Adjust Color"-filter. With that I can change the color easily, but I want to get the same effect in AS3.
有没有人对如何线索? 感谢:)
Does anyone have a clue on how? Thanks:)
要更改影片剪辑的颜色使用的ColorTransform
类和 transform.colortransform
的属性影片剪辑
:
To change MovieClip color use ColorTransform
class and transform.colortransform
property of the MovieClip
:
var ct:ColorTransform = new ColorTransform();
ct.color = 0xCFFF54;
yourMovieClip.transform.colorTransform = ct;
高级法
使用这个方法,你可以改变亮度,对比度等。
Using this method you can change brightness, contrast, etc.
import fl.motion.AdjustColor;
var adjustColor:AdjustColor = new AdjustColor();
adjustColor.brightness = 50;
adjustColor.contrast = 50;
adjustColor.saturation = 50;
adjustColor.hue = 50;
var matrix:Array = adjustColor.CalculateFinalFlatArray();
var colorMatrix:ColorMatrixFilter = new ColorMatrixFilter(matrix);
yourMovieClip.filters = [colorMatrix];