Alpha Mask의 완벽한 사용 예와 비슷합니다.
import spark.core.MaskType;
private function addMask():void {
var vidMask:SpriteVisualElement = new SpriteVisualElement();
// first mask the entire thing transparent
vidMask.graphics.beginFill(0x000000, 0);
vidMask.graphics.drawRect(0,0,480,320);
vidMask.graphics.endFill();
// then draw the rounded rectangle (or whatever) that you want to show
vidMask.graphics.beginFill(0x000000, 1); //color doesn't matter
vidMask.graphics.drawRoundRect(0,0,480, 320, 200, 200); // choose
vidMask.graphics.endFill();
addElement(vidMask); //the mask has to be on the Display List
vid.mask = vidMask; // attach the mask to the sve
vid.maskType = MaskType.ALPHA; // choose alpha masking
}
을 그리고 당신의 MXML에서 :
이 시도
<s:SpriteVisualElement id="vid" width="480" height="320" addedToStage="addMask()">
UPDATE 사실
, 지금은 좀 더 그것에 대해 생각하는 것이 나의 초기 대답은 잘못된 것입니다. 불투명도에 그라데이션이 없으므로 실제로는 클리핑 마스크 (Alpha가 아닌) 만 있으면됩니다. 다음과 같이 당신은 addMask
기능을 업데이트 할 수 있습니다 : 당신이 당신의 마스크의 등급 불투명도를 사용하여 끝내는하지 않는 한 그것은 플레이어가 수행하는 합성을 단순화해야하기 때문에
private function addMask():void {
var vidMask:SpriteVisualElement = new SpriteVisualElement();
// draw the rounded rectangle (or whatever) that you want to show
vidMask.graphics.beginFill(0x000000, 1); //color doesn't matter
vidMask.graphics.drawRoundRect(0,0,480, 320, 200, 200); // the last two effect the roundness
vidMask.graphics.endFill();
addElement(vidMask); //the mask has to be on the Display List
vid.mask = vidMask; // attach the mask to the sve
vid.maskType = MaskType.CLIP; // choose clip masking
}
,이 방법은 바람직 할 것이다.
s를 사용하지 않는 이유가 있습니까? Ellipse? –
타원형, 둥근 모서리 또는 내 경우와 일치하는 것이 있다면 상관 없습니다. 하지만 내가 원했던 것은 시각적 인 원격 비디오가 다른 것들과 겹치지 않는다는 것입니다! – Stefan