# Multiple Masks with for Multiple MC's

**URL:** <https://forum.kirupa.com/t/multiple-masks-with-for-multiple-mcs/189391>\
**Category:** flash\
**Created:** [June 2, 2006, 4:16am UTC](https://forum.kirupa.com/t/multiple-masks-with-for-multiple-mcs/189391 "2006-06-02T04:16:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deltatuk](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@deltatuk](https://forum.kirupa.com/u/deltatuk)\
**Post date:** [June 2, 2006, 4:16am UTC](https://forum.kirupa.com/t/multiple-masks-with-for-multiple-mcs/189391/1 "2006-06-02T04:16:26Z")

</div>

I want to be able to dynamically create multiple masks as movieclips and them apply those masks to other movieclips using actionScript. My code is below, it’s still in the logic phase though. I want to be able to loop over this code for as many movieclips is as neccessary. (I realize that the instance names would be the same as it is currently written)

mc1 is a blank containerMC

var depth = mc1.getNextHighestDepth();

mc1.createEmptyMovieClip(“picClip”, depth);  
mc1.picClip.createEmptyMovieClip(“maskClip”, 1);  
with(mc1.picClip.maskClip){  
lineStyle(0,0xFFFFFF,100);  
beginFill(0x000000,30);  
moveTo(0,0);  
lineTo(100,0);  
lineTo(100,100);  
lineTo(0,100);  
lineTo(0,0);  
endFill();  
}  
mc1.picClip.setMask(mc1.picClip.maskClip);
