Flash / Actionscript:如何使重叠的精灵不可见
查看图片 http://reggino.kingsquare.nl/tmp/actionscriptProblem.jpg
你好,
我无法理解这个问题...
我有两个精灵,这些精灵的交集的 alpha 为 0。我尝试了所有混合模式和过滤器,但它们似乎都不合适。
我一直对这三个之上的额外层感到困惑,相互遮盖等等,但这变得一团糟并且难以维护(必须拖动文本等......)。你们中的任何一位大师对如何克服这个问题有建议吗?我认为应该有一个更简单的方法......?
预先感谢您的帮助!
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 and 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些精灵确实是兄弟姐妹,但在重叠区域你可以“看穿它们”。提供的图像说明了这种行为。
[编辑]
我刚刚通过生成自定义的新位图设法达到了预期的结果!请参阅此博文。
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.
交集的
alpha
如何变为零?如果 sprite1(文本)和 sprite2(条带)是同级,您可以通过调用
addChild(text); 在调用
addChild(strip);
之前(或通过调用addChildAt(text, 0);
) - 这样,条带将位于文本之上并覆盖它如果有重叠。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 callingaddChild(strip);
(or by callingaddChildAt(text, 0);
) - This way, the strip will be on top of the text and cover it if there is an overlap.