开发者

AS3 Mask changes the color of masked movieclip

开发者 https://www.devze.com 2023-03-03 01:30 出处:网络
I\'m trying to mask a movieclip using a mask created with AS3 but it changes the color of the movieclip being masked. I would like the mask to not change the color of the masked movieclip. Here is my

I'm trying to mask a movieclip using a mask created with AS3 but it changes the color of the movieclip being masked. I would like the mask to not change the color of the masked movieclip. Here is my code:

mask_mc.mask=masked_mc;

drawMask();

function drawMask():void {
   mask_mc.graphics.clear();
   mask_mc.graphics.beginFill(0x000000,1);
   mask_mc.graphics.drawRect(0,0,750,250);
   mask_mc.graphics.endFill();
}

The masked movieclip becomes the same color as the color defined in beginFill. In t开发者_开发技巧he example above, masked_mc turns black (as defined in beginFill). Removing beginFill masked everything and revealed nothing. I've not found anyone else having this problem. Perhaps I going about this all wrong. Thanks in advance for any help on masking with AS3 without changing the color of the movieclips being masked.


You also have to add the mask into the display list :

SomeClip.addChild(masked_mc)

and i see that you are drawing on your clip and not on your mask so it may explain the color you see :

var g:Graphics = masked_mc.graphics
g.clear()
g.beginFill(0x000000,1)
g.drawRect(0,0,750,250)
g.endFill()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号