Flash / Actionscript: How to make overlapping sprite invisible
See image at http://reggino.kingsquare.nl/tmp/actionscriptProblem.jpg
Hi there,
I can't get my head around this one...
I'm having two sprites, where the intersection of these sprites has an alpha of 0. I tried all the blendmodes and filters, but none of them seems appropriate.
I've been puzzeling with extra layers on top of these three, masking each other etc, but that becomes a mess a开发者_StackOverflownd makes it difficult to maintain (the text has to be dragged etc.... ). Does any of you guru's have a suggestion how to overcome this problem? There should be an easier way i think...?
Thanks in advance for your help!
The sprites are siblings indeed, but at the overlapping areas you can 'see through them'. The image provided illustrates this behaviour.
[edit] I just managed to achieve the desired result by generating a custom new bitmap! See this blogpost.
How is the alpha
of the intersection becoming zero?
If sprite1 (the text) and sprite2 (the strip) are siblings, you can addChild them in such a way that strip is at a higher position than text in the parent's display list by calling addChild(text);
before calling addChild(strip);
(or by calling addChildAt(text, 0);
) - This way, the strip will be on top of the text and cover it if there is an overlap.
精彩评论