开发者

Flash AS3 How do I remove overlap hole on mask?

I have made a Actions Script 3 code that fetches an image, does an addchild do it and adding a mask to it aswell.

Everything works fine, except the mask I've made is an animated MovieClip, and this MovieClip hides some spots where 2 or more objects inside that MovieClip overlaps each others. I haven't found how to remove this effect, so the mask is valid on overlaping aswell.

So basicly I need to know how to disable overlaping exclude effect in AS3. Is there a setting of some sort to solve this problem?

Code here:

// area is a MovieClip
// images_loaded[current_int] is a loaded image
// slider is a MovieClip, which I use to mask with
next_image          =   area.addChild(images_loaded[current_int]);
next_image.x        =   0;
next_image.y        =   0;
var masky:MovieClip =   new slider;
masky.x             =   0;
masky.y             =   0;
area.addChild(masky);
n开发者_C百科ext_image.mask =   masky;

Thanks!

EDIT:

Here's the problem:

Flash AS3 How do I remove overlap hole on mask?

The slider-MovieClip got 7 layers. 1st layer is the letter M and 7th layer is a big box. Basicly I first want to fill up the Mask with the letter first, then cover it whole with the bix box. However when these 2 overlays you can the gray result (which is the background). I'd like it to show the entire picture, not having this overlap effect.


this is caused by flash.display.GraphicsPathWinding

if you're producing your graphics with either GraphicsPath class or the drawPath() function, simply assign the appropriate value to the winding parameter. if you're producing graphics within your mask Sprite using drawing convience methods (IE: drawRect), you can avoid winding issues by wrapping each draw with beginFill() and endFill().

so instead of writing this:

s.graphics.beginFill(0xFF0000, 1.0);
s.graphics.drawRect(0, 0, 100, 100);
s.graphics.drawRect(20, 20, 100, 100);
s.graphics.drawRect(40, 40, 100, 100);
s.graphics.endFill();

Flash AS3 How do I remove overlap hole on mask?

write this:

s.graphics.beginFill(0xFF0000, 1.0);
s.graphics.drawRect(0, 0, 100, 100);
s.graphics.endFill();
s.graphics.beginFill(0xFF0000, 1.0);
s.graphics.drawRect(20, 20, 100, 100);
s.graphics.endFill();
s.graphics.beginFill(0xFF0000, 1.0);
s.graphics.drawRect(40, 40, 100, 100);
s.graphics.endFill();

Flash AS3 How do I remove overlap hole on mask?


Masking sure can be a mystery in Flash.

I solved this problem earlier by Breaking all into one layer instead. Then there were no layers which could overlap each other.

This article and some of the comments contains very good solutions for weird mask behaviors. Hopefully they will help you aswell!

One soluton which is always worth to try is cacheAsBitmap = true

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜