//方法一
var color:Color = new Color(mc);
this.r_mc.k_mc.onPress = function() {
this.startDrag(false,0,0,100,0);
this.onEnterFrame = function() {
var temp_color:Object = color.getTransform();
temp_color.bb = temp_color.gb=temp_color.rb=(this._x-50)*5.1;
this._txt.text = "亮度:"+Math.round((this._x-50)*5.1);
color.setTransform(temp_color);
};
this.onMouseUp = function() {
this.stopDrag();
delete this.onEnterFrame;
delete this.onMouseUp;
};
};
//方法二
import flash.filters.ColorMatrixFilter;
this.b_mc.k_mc.onPress = function() {
this.startDrag(false,0,0,100,0);
this.onEnterFrame = function() {
var v:Number = this._x/50;
mc2.filters = [new ColorMatrixFilter([v, 0, 0, 0, 0, 0, v, 0, 0, 0, 0, 0, v, 0, 0, 0, 0, 0, 1, 0])];
};
this.onMouseUp = function() {
this.stopDrag();
delete this.onEnterFrame;
delete this.onMouseUp;
};
};
mc2.filters = [new ColorMatrixFilter([v, 0, 0, 0, 0, 0, v, 0, 0, 0, 0, 0, v, 0, 0, 0, 0, 0, 1, 0])];
这个和方法一是相同的原理,都是让红,绿,蓝三个通道的值同时做相同的变化
ColorMatrixFilter矩阵中每个值的这定义帮助中有明确说明和代码举例,需要的只是时间和精力去看