# Help on ColorMatrix Filter through Action Script

**URL:** https://forum.kirupa.com/t/help-on-colormatrix-filter-through-action-script/235380
**Category:** flash
**Created:** [August 10, 2007, 3:25pm UTC](https://forum.kirupa.com/t/help-on-colormatrix-filter-through-action-script/235380 "2007-08-10T15:25:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mcrodrigues](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@mcrodrigues](https://forum.kirupa.com/u/mcrodrigues)
#### Post date: [August 10, 2007, 3:25pm UTC](https://forum.kirupa.com/t/help-on-colormatrix-filter-through-action-script/235380/1 "2007-08-10T15:25:40Z")

</div>

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:

```auto

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!!!
