AS3.0 圖片變黑白 圖片彩色變黑白代碼 復制代碼代碼如下:import flash.filters.ColorMatrixFilter;//導入色彩濾鏡 var matrix:Array = [ 0.5,0.5,0.082,0,0,0.5,0.5,0.082,0,0,0.5,0.5,0.082,0,0,0,0,0,1,0 ];//定義色彩數組 var colorMat:ColorMatrixFilter = new ColorMatrixFilter(matrix);//創建濾鏡對象 //添加鼠標事件 image_mc.addEventListener(MouseEvent.MOUSE_OVER,over); image_mc.addEventListener(MouseEvent.MOUSE_OUT,out); image_mc.filters = [colorMat]; function over(e:MouseEvent):void{ image_mc.filters = []; } function out(e:MouseEvent):void{ image_mc.filters = [colorMat]; }