标签:
var bmpd:BitmapData; var matrix:Matrix; var bmp:Bitmap; var size:Number = 5; /** * @author:Frost.Yen * @E-mail:871979853@qq.com */ function mosaic(source:MovieClip,size:Number):void { if (bmpd) { bmpd.dispose(); } if (matrix) { matrix = null; } bmpd = new BitmapData(source.width / size,source.height / size,true,0); matrix = new Matrix ; matrix.scale(1 / size, 1 / size); bmpd.draw(source, matrix); bmp = new Bitmap(bmpd); source.addChild(bmp); bmp.width = source.width; bmp.height = source.height; } mc.addEventListener(MouseEvent.CLICK,_chang); function _chang(e:MouseEvent):void { mosaic(mc,size); mc.mouseEnabled = false; }
[ActionScript 3.0] AS3.0 马赛克效果
标签:
原文地址:http://www.cnblogs.com/frost-yen/p/5622836.html