I have a few library clips that are masked videos, but the first frame is a PNG, also masked. Nothing has instance names.
I want to be able to work with that PNG in script, but I can't figure out how to work out which child it is from the display list for each lib clip.
I've set up a simple demo running this code:
for(var n:Number = 0; n < Test.numChildren; n++){
var obj
isplayObject = Test.getChildAt(n);
trace("obj - " + obj + ", mask: " + obj.mask);
}
on the stage is one instance of a library clip. In the clip are two layers, one is a shape that is the mask, the other is a PNG.
The output is: > obj - [object Shape], mask: null obj - [object Shape], mask: null
So the PNG is coming back as a Shape, and the mask value isn't filled in for masks set up on the stage it seems.
Anyone got any ideas?
I could just wrap the PNGs in an MC, give that an instance name and grab childAt(0) on that wrapper MC, but this would seem a useful thing to be able to do.
this is to do with the way flash compresses things at compile time.
because the "bitmap" on the stage is only ever able to be used in that one instance, it is not created as a bitmap, but rather as a shape.
If you give that bitmap a linkage ID in the library, thereby making it a dynamically instantiatable object, it will retain its bitmap status, and you will see an "[Object Bitmap]" show up in your output window when you run your code
so I guess it also resolves the mask so that also disappears, interesting. Kind of annoying cos it means I have to either edit something (albeit trivial) in the IDE or get the designers to do so. On the other hand I changed my approach to my problem here and don't actually need to do this anymore. Thanks for the 'splanation Lith.