c续之前的柔化后觉得BitmapData函数做到了很多之前做不到的效果了,尤其是在制作画板时需要的吸管工具,在这里只要一行函数就可以取得我们要的?色了。。真方便啊
MovieClip.prototype.smoothImageLoad=function(img){//柔化?片
varm=this.createEmptyMovieClip("mc",this.getNextHighestDepth());
varlistener=newMovieClipLoader();
listener.onLoadComplete=function(mc:MovieClip){
mc.onEnterFrame=function(){
varbitmap=newflash.display.BitmapData(this._width,this._height);
bitmap.draw(this);
this.attachBitmap(bitmap,1,true,true);
this.smoothImageLoadComplete();
updateAfterEvent();
}
};
listener.loadClip(img,m);
};
MovieClip.prototype.pickColor=function(){//取得?片?色
varbitmap=newflash.display.BitmapData(this._width,this._height);
bitmap.draw(this);
if(bitmap!=undefined){
varmyColor=bitmap.getPixel(this._xmouse,this._ymouse);
return"0x"+myColor.toString(16).toUpperCase();
}
}
this.createEmptyMovieClip("mc",0);
mc.smoothImageLoad("doggy.jpg");
mc._xscale=mc._yscale=300;
this.onMouseMove=function(){
myColor=mc.pickColor();//取得?片的?色函?
varcolorTansform=newflash.geom.ColorTransform();
colorTansform.rgb=myColor;
colorMc.transform.colorTransform=colorTansform;
colorTxt.text=myColor;
updateAfterEvent();
}