开发者

AS3: Apply Mask to Multiple MovieClips

I have two MovieClips onscreen, and I want to apply the same mask to both. I set the the masks using

mc1.mask = mymask;
mc2.mask = mymask;

Only mc2 receives the mask. How can I set the same mask for two different MovieClips without having to resort to putting them both in a singl开发者_运维技巧e MovieClip?


Make the mask a class and use instances of this class to mask each movie clip.

Your class could have set properties or if needs be you could pass parameters in the constructor for more flexibility...

var mask1:MyMask = new MyMask();
var mask2:MyMask = new MyMask();

mc1.mask = mask1;
mc2.mask = mask2;


if you are attempting to apply the same mask on both of your two sprites you can set the 2 sprite objects as children of a display object container and assign the mask to the container.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜