# Scripted masking... Please help

**URL:** <https://forum.kirupa.com/t/scripted-masking-please-help/217239>\
**Category:** flash\
**Created:** [February 24, 2007, 6:03pm UTC](https://forum.kirupa.com/t/scripted-masking-please-help/217239 "2007-02-24T18:03:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sig](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@sig](https://forum.kirupa.com/u/sig)\
**Post date:** [February 24, 2007, 6:03pm UTC](https://forum.kirupa.com/t/scripted-masking-please-help/217239/1 "2007-02-24T18:03:34Z")

</div>

[FONT=Courier New]Hi

I will try to explain the best I can but i’m still quite new to ac and still learning…

I am trying to create a rain scene and I have scripted some random rain to fall over the scene I scripted the rain using this code  
…  
this.createEmptyMovieClip(“canvas\_mc”,10);  
var i = 0;  
myInterval = setInterval(addrain, 500);  
function addrain() {  
if(i\<50) {  
var t:MovieClip = canvas\_mc.attachMovie(“raindrop”, “rain”+i,canvas\_mc.getNextHighestDepth());  
i++;  
t.\_xscale = t.\_yscale=Math.random()\*90+10;  
t.\_x = Math.random()\*Stage.width;  
t.\_y = -50;  
}  
}

…  
all works well, but now I want to mask the rain movieclips I haved tried using the [/FONT][FONT=Courier New]“my\_image.setMask(rain);” but it doesn’t work correctly I think it’s because I am creating 50 diffrent instances of the same mc

So the question is how can I apply a mask to all the movieclips produced …???

I have attached the fla. if anyone can be kind enough to take a look

edit\*\*  
the file was to big to upload here so you can download it here  
[http://il.tirminal.net:7001/outPost/login.aspx?id=1172339936!8050](http://il.tirminal.net:7001/outPost/login.aspx?id=1172339936%218050)  
just enter the name as kirpa and click to download… it’s only 276kb so wont take that long at all…

Thanks for taking the time to look  
[/FONT]
