# Help with this mask

**URL:** <https://forum.kirupa.com/t/help-with-this-mask/201523>\
**Category:** flash\
**Created:** [September 22, 2006, 2:01am UTC](https://forum.kirupa.com/t/help-with-this-mask/201523 "2006-09-22T02:01:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalgin](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dalgin](https://forum.kirupa.com/u/dalgin)\
**Post date:** [September 22, 2006, 2:01am UTC](https://forum.kirupa.com/t/help-with-this-mask/201523/1 "2006-09-22T02:01:21Z")

</div>

Here is my code:

createEmptyMovieClip(“pen\_mc”, 5);  
myColor = Math.round( Math.random()\*0xFFFFFF );  
pen\_mc.lineStyle(4, myColor, 100);  
if (\_global.newData[\_root.\_currentframe - 20].nodeName.toUpperCase() == ‘EVENT’) {  
element = \_global.newData[\_root.\_currentframe-20].firstChild;  
while (element.nodeName != null) {  
if (element.nodeName.toUpperCase() == “LAT\_ATTACKER”) {  
lan\_attacker = element.firstChild.nodeValue;  
}  
if (element.nodeName.toUpperCase() == “LON\_ATTACKER”) {  
lon\_attacker = element.firstChild.nodeValue;  
}  
if (element.nodeName.toUpperCase() == “LAT\_VICTIM”) {  
lan\_victim = element.firstChild.nodeValue;  
}  
if (element.nodeName.toUpperCase() == “LON\_VICTIM”) {  
lon\_victim = element.firstChild.nodeValue;  
}  
if (element.nodeName.toUpperCase() == “DETAILS”) {  
details = element.firstChild.nodeValue;  
}  
element = element.nextSibling;  
}  
}  
convert(lan\_attacker, lon\_attacker, 1200, 2400);  
pen\_mc.moveTo(x, y);  
oldx = x;  
oldy = y;  
convert(lan\_victim, lon\_victim, 1200, 2400);  
pen\_mc.curveTo((x+oldx)/2, (y-oldy), x, y);  
pen\_mc.setMask(movie);

function convert(lat, lon, h, w) {  
var long:Number = lon;  
lati = ((lat)-1)+90;  
long = (lon-1)+1+180;  
x = Math.round(long\*(w/360));  
tmp = Math.round(lati\*(h/180));  
y = h-tmp;  
}

I have many layers in the main stage. on frame 20, I have this code drawing a curve between two countries in “Lines” layer . I have another layer right above this layer called “mask” in which in frame 20, I make a rectangle and until frame thirty, I move the rectangle with tween. I right clicked on the mask layer and set mask. Hoping that by masking the layer below it, I can make the curve being draw real time. But it is not working.

Please help.

I think my mask is not going over the pen\_mc movie clip. how can I do this.
