我是新手到flash,as3.Im通过flepstudio教程学习flash。我从tere网站获得此代码。 现在我打算减小放大镜的尺寸。我不知道在哪里通过编码减少maginifer obj的大小。这是以下代码。
private function createClips():void
{
circle_mc=new Circle();
addChild(circle_mc);
container_mc=new MovieClip();
addChild(container_mc);
mask_mc=new Circle();
addChild(mask_mc);
glass_mc=new Glass();
addChild(glass_mc);
}
private function initGlass():void
{
bit_1=new BitmapData(loader.width,loader.height,false,0x00FFFFFF);
bit_2=new BitmapData(circle_mc.width,circle_mc.height,false,0x00FFFFFF);
bit_3=new BitmapData(300,300,true,0x00FFFFFF);
disp_filter=new DisplacementMapFilter(bit_2,new Point(0,0),1,1,50,50);
loader.width/=2;
loader.height/=2;
circle_mc.visible=false;
container_mc.mask=mask_mc;
bit_1.draw(loader);
bit_2.draw(circle_mc);
var b:Bitmap=new Bitmap(bit_3)
container_mc.addChild(b);
}
private function magnify(evt:Event):void
{
var distance:Number=mask_mc.width/2;
container_mc.x=mouseX-distance;
container_mc.y=mouseY-distance;
mask_mc.x=mouseX-distance;
mask_mc.y=mouseY-distance;
glass_mc.x=mouseX;
glass_mc.y=mouseY;
bit_3.copyPixels(bit_1,new Rectangle(mouseX*2-distance,mouseY*2-distance*1.5,200,200),new Point(0,0))
bit_3.applyFilter(bit_3,bit_3.rect,new Point(0,0),disp_filter)
}
}
If i reduce this size of maginifier i can able to finish my homework. :)
答案 0 :(得分:0)
在应用为遮罩之前,请减小遮罩的MC尺寸。你的问题将得到解决。