[as3]
// import flash.filters.ColorMatrixFilter;

function blackAndWhite($target:DisplayObject, $enabled:Boolean):void
{
var rc:Number = 1/3;
var gc:Number = 1/3;
var bc:Number = 1/3;
var cmf:ColorMatrixFilter = new ColorMatrixFilter([rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, 0, 0, 0, 1, 0]);

if ($enabled) {
$target.filters = [cmf];
} else {
$target.filters = [];
}
}

blackAndWhite(myMovieClip, true);
[/as3]

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation