Detecting if there is a timeline mask
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?
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
精彩评论