How can you figure out programmatically that a shape is used as a mask?
Use case:
1) In the authoring tool, create 2 layers with a shape on each.
2) Set the topmost layer as a mask layer.
3) If you do a trace, neither shapes will have their mask properties set, and yet, the 'topmopt' shape ( from the mask layer ) will nevertheless act as a mask.
4) I would like to know how I could identify via actionscript if a shape is used as a mask in this particular situation.
Thank you dmennonoh & esdebon !
What an annoyance that there is no way to identify elements on mask layers, via AS.
What I am resorting to doing is using nomenclature (ex: "myShape_mask" <-- if getChildAt(i).name.split("_").indexOf( "mask" ) != -1 ) to identify what is on a mask layer or not, to assign the "mask" properties of masked objects, programmatically, as well as do other processing.
You shouldn't have to split the name on the underscore.... name.indexOf(...etc should be all you need if you are looking for "mask" in the name
Is there some reason you do not create the masks programmatically instead of using the timeline? It would probably remove any annoyance you have.
Ned, thank's for the tip: I didn't know String had an indexOf().
The authoring tool is much more practical for creating intricate / deep-treed assets (like animated characters): one can preview that the masks work properly, and I can rely on someone who is not a programmer to create the assets.
Setting DisplayObject.mask via framescript is not really something I would want an Artist to have to deal with (+ it would be hard to debug if something went wrong ).
North America
Europe, Middle East and Africa
Asia Pacific