I've done some digging and can't find any clear documentation on this. When the user clicks the stage, I would like to pull an instance of Symbol A from the library and place it on the stage, then pull an instance of Symbol B and assign it as a mask.
I am sure Symbol B is a "valid" mask, as it simply contains a shape.
In the old days, this would be as simple as:
symbolAInstance.mask = symbolBInstance;
Any way to accomplish this using JS/CreateJS?
Thanks!
MovieClips can not be used directly as masks in CreateJS, only Shapes/Graphics. http://createjs.com/docs/easeljs/classes/DisplayObject.html#property_mask
If you want to use something more complex like a Bitmap or MovieClip, it is possible, but it takes a few steps, and has limitations.
cacheCanvas
(the bitmap generated by the cache)The documentation for the AlphaMaskFilters has a simple example. http://createjs.com/docs/easeljs/classes/AlphaMaskFilter.html
One of the main limitations is that if you change the mask or masked clips (play timeline, change size, etc), then you will have to re-cache whatever changes. So if the mask changes, both the mask and masked clip need to be re-cached. Doing this to animate a mask is very expensive, and should be avoided if possible.
Hope that helps.