# Masked line

**URL:** <https://forum.kirupa.com/t/masked-line/77093>\
**Category:** flash\
**Created:** [January 24, 2005, 5:31pm UTC](https://forum.kirupa.com/t/masked-line/77093 "2005-01-24T17:31:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pattt](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@Pattt](https://forum.kirupa.com/u/Pattt)\
**Post date:** [January 24, 2005, 5:31pm UTC](https://forum.kirupa.com/t/masked-line/77093/1 "2005-01-24T17:31:23Z")

</div>

Hi again. 🙂  
Can I do a mask for the lines? Or a area where I can draw, and outside the area I can not draw… Understand what I mean?  
**\<{([FLASH: MX 2004])}\>**

```auto
 var thickness = 1; //Thickness of line 
var lcolour = "0x000000"; //Colour of line 
var scolour = "0x999999"; //Colour of fill 
var linjealpha = 100; //Transparency of the linje 
var mDown = false; 
var startx, starty, endx, endy; 
//Gets the starting point when mouse is clicked 
this.onMouseDown = function() {
	var id:Number = _root.getNextHighestDepth() 
	linje = _root.createEmptyMovieClip("linje_" + id, id) 
	mDown = true; 
	startx = _xmouse; 
	starty = _ymouse; 
}; 
//When mouse is released stop drawing linje 
this.onMouseUp = function() {
	 mDown = false; 
}; 
//Do all the commands 
this.onEnterFrame = function() { 
   //Get the mouse coordinates 
   endx = _xmouse; 
   endy = _ymouse; 
   //Destroy current linje to prepare for new one 
	
   //Draw the linje if mouse is down 
   if (mDown) {  
	  linje.clear();
	  //linje.beginFill(scolour, linjealpha);
   linje.lineStyle(thickness, lcolour, linjealpha);
	  linje.moveTo(startx, starty); 
	  //linje.lineTo(endx, starty); 
	  linje.lineTo(endx, endy); 
	  //linje.lineTo(startx, endy); 
	  //linje.lineTo(startx, starty); 
	  //linje.endFill(); 
   } 
};
stop();
 

```
