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