View Full Version : how to remove colorMatrixFilter

12-04-2008, 11:49 AM
I have a function that desaturates a bitmap image.

private function desaturate():void{
var mat:Array = [ .33,.33,.33,0,0,.33,.33,.33,0,0,.33,.33,.33,0,0,.3 3,.33,.33,1,0 ];
var colorMat:ColorMatrixFilter = new ColorMatrixFilter(mat);
var myFilters:Array = new Array();
mythumb.filters = myFilters;

This works fine.

But I need a function that re-saturates the bitmap (in other words, remove the color transformation. I've tried setting mythumb.filters = null as the documentation suggests, but that doesn't work.

Any suggestions would be greatly appreciated. Thanks.

Peter Cowling
12-05-2008, 10:34 AM

The way to 'remove' a filter is to build an empty array and apply it as the displayObjects filters i.e.:

mythumb.filters = [];