/**
* 显示对象变为黑白
* @param child 显示黑白的对象
*/
private function applyGray(child:InteractiveObject):void{
var matrix:Array = new Array();
matrix = matrix.concat([0.3086,0.6094,0.0820,0,0]);//red
matrix = matrix.concat([0.3086,0.6094,0.0820,0,0]);//green
matrix = matrix.concat([0.3086,0.6094,0.0820,0,0]);//blue
matrix = matrix.concat([0,0,0,1,0]);//alpha
applyFilter(child,matrix);
child.mouseEnabled = false;
}
/**
* 添加灰色滤镜
* @param child 添加滤镜的对象
* @param matrix 滤镜数组
*/
private function applyFilter(child:InteractiveObject,matrix:Array):void{
var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
var filters:Array = new Array();
filters.push(filter);
child.filters = filters;
}
/**
* 移除灰色滤镜
* @param child
*/
private function removeFilter(child:InteractiveObject):void{
child.filters = [];
}