AS3 - 更改影片剪辑,颜色使用过滤器 [英] AS3 - Change MovieClip-Color Using Filters

查看:540
本文介绍了AS3 - 更改影片剪辑,颜色使用过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我可以创建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];

这篇关于AS3 - 更改影片剪辑,颜色使用过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆