Hi guys!
I am trying to learn how to apply a colorMatrix filter and tween it through AS… So far, I´ve read the tutorial that´s is here at Kirupa´s… However, It only covers applying the glowfilter… It seems to me that applying the colorMatrix filter may be a little bit different… So, besides reading kirupa´s tutorial, I´ve found some info in flash´s help. But again, as I am not experienced with AS, I could not find a solution…
Here is the code that I have so far:
import flash.filters.ColorMatrixFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
System.security.allowDomain("http://www.helpexamples.com");
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip):Void {
target_mc.watch("brightness", brightnessWatcher, target_mc);
// animate the target_mc movie clip between -100 and +100 brightness
var t:Object = new Tween(target_mc, "brightness", Elastic.easeOut, 100, -100, 3, true);
};
this.createEmptyMovieClip("img_mc", 10);
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mclListener);
img_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg", img_mc);
function brightnessWatcher(prop:String, oldVal:Number, newVal:Number, target_mc:MovieClip):Number {
var brightness_array:Array = [1, 0, 0, 0, newVal,
0, 1, 0, 0, newVal,
0, 0, 1, 0, newVal,
0, 0, 0, 1, 0];
target_mc.filters = [new ColorMatrixFilter(brightness_array)];
return newVal;
};
button1.onRollOver = function() {
t.continueTo(-200, 2);
}
Can any of you guys take a look at it and give me a hand?
Thanks in advance!!!