检测是否存在时间线掩码
我在 Flash 上遇到了一个非常奇怪的行为。 如果您在 Flash IDE 上创建一个带有与其关联的蒙版的形状,保存它然后将其导出为 swf,则您无法以编程方式知道存在蒙版(displayObject.mask 为 null),
下面是一个简单的测试脚本来证明这一点:
//executed on enter_frame with the root object
function test(d:DisplayObject) : Void
{
if (Std.is(d, DisplayObjectContainer))
{
var s:DisplayObjectContainer = cast d;
for (i in 0...s.numChildren)
test(s.getChildAt(i));
}
if (d.mask != null)
trace("FOUND " + d.name);
}
语法有点不同,因为它是 haxe,但它会在普通 AS3
跟踪上显示相同的内容,即未找到掩码!我只需要以不同的方式处理附有面具的情况,那么有什么方法/解决这个奇怪的问题吗?
I am bumping into a very strange behaviour on Flash.
If you on the Flash IDE create a shape with a mask associated to it, save it and then export it as a swf, you cannot programatically know there is a mask (displayObject.mask is null)
Here's a simple test script to prove that:
//executed on enter_frame with the root object
function test(d:DisplayObject) : Void
{
if (Std.is(d, DisplayObjectContainer))
{
var s:DisplayObjectContainer = cast d;
for (i in 0...s.numChildren)
test(s.getChildAt(i));
}
if (d.mask != null)
trace("FOUND " + d.name);
}
The syntax is a little different since it's haxe, but it will display the same on vanilla AS3
traces that no mask was found! I just need to handle differently the cases where there is a mask attached to it, so is there any way/workaround this strange issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很确定这是不可能的......这是一个支持我的线程:
http://www.actionscript.org/forums/archive/index.php3/t-184762.html
Pretty sure this is impossible... and here is a thread to back me up:
http://www.actionscript.org/forums/archive/index.php3/t-184762.html