brush_mc를 사용하면 브러쉬 스트로크에서 픽셀을 투명하게 만드는 마스크를 쓸 수 있습니다. 그래서 시각적으로 마스크가 지워지고 마스크 된 무비 클립이 나타납니다. 마스크가 완전히 투명하게 바뀌면 추적하고 싶습니다.AS3 마스크가 완전히 채워 졌는지 확인할 수 있습니까?
마스크가 비트 맵 데이터없이 완전히 투명하게되어 있는지 확인할 수 있습니까?
// this creates a mask that hides the movieclip on top
var mask_mc:MovieClip = new MovieClip();
addChild(mask_mc)
//assign the mask to the movieclip it should 'cover'
mc1.mask = mask_mc;
//add event listeners for the 'brush'
brush_mc.addEventListener(MouseEvent.MOUSE_DOWN,brushDown);
brush_mc.addEventListener(MouseEvent.MOUSE_UP,brushUp);
//function to drag the brush over the mask
function brushDown(dragging:MouseEvent):void{
dragging.currentTarget.startDrag();
MovieClip(dragging.currentTarget).addEventListener(Event.ENTER_FRAME,erase) ;
mask_mc.graphics.moveTo(brush_mc.x,brush_mc.y);
}
//function to stop dragging the brush over the mask
function brushUp(dragging:MouseEvent):void{
dragging.currentTarget.stopDrag();
MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER_FRAME,erase);
}
//fill the mask with transparant pixels so the movieclip turns visible
function erase(e:Event):void{
with(mask_mc.graphics){
beginFill(0x000000);
drawRect(brush_mc.x,brush_mc.y,brush_mc.width,brush_mc.height);
endFill();
}
}
저는 As3을 처음 접했기 때문에 설명이 약간 흐려질 수는 있지만 그것이 내 자신을 더 명확하게 해줍니다. 언제든지 저를 바로 대답하십시오 – Opoe
왜 bitmapdata를 사용하고 싶지 않으십니까? – grapefrukt
@grapefrukt 그것을 사용하고 싶습니다만, 마스크만으로 이해할 수 있다면 쉽게 이해할 수있을 것이라고 생각했습니다. 그러나, 나는 비트 맵 데이터를 가지고 몇 가지 시도를했지만 작동시키지 못했다. 당신은 어떤 제안이라도 있으면 환영보다 더! – Opoe