# Masking on MouseOver?

**URL:** https://forum.kirupa.com/t/masking-on-mouseover/296547
**Category:** Uncategorized
**Created:** [September 16, 2009, 12:26pm UTC](https://forum.kirupa.com/t/masking-on-mouseover/296547 "2009-09-16T12:26:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![longneck](https://avatars.discourse-cdn.com/v4/letter/l/9f8e36/32.png) [@longneck](https://forum.kirupa.com/u/longneck)
#### Post date: [September 16, 2009, 12:26pm UTC](https://forum.kirupa.com/t/masking-on-mouseover/296547/1 "2009-09-16T12:26:54Z")

</div>

Hi,

here’s the thing. I’ve made [this banner.](http://fireballing.com/designgajol/300x250_2.html)

…but instead of the paintbrush masking things when the mouse is clicked I would like it to start masking when the mouse is moved over the banner.

Here’s my code:

[COLOR=“Blue”]stop();

square\_mc.onEnterFrame = function() {  
var xMouse = \_root.\_xmouse;  
var yMouse = \_root.\_ymouse;  
if(Math.abs(xMouse - this.\_x) \< 2) {  
this.\_x = xMouse;  
this.\_y = yMouse;  
} else {  
this.\_x -= (this.\_x-xMouse) / 2;  
this.\_y -= (this.\_y-yMouse) / 2;  
}  
}

\_global.h = 15;  
\_root.createEmptyMovieClip(“mask”,3);  
\_root.foo.\_visible = 0  
mask.onMouseDown = function()  
{  
this.onMouseMove = function()  
{  
this.a++;  
this.createEmptyMovieClip(“l”+this.a,10+this.a);  
this.lc = this[‘l’+this.a];  
with(this.lc)  
{  
beginFill(0x000000,100);  
moveTo(0,-h/2)  
lineTo(100,-h/2)  
lineTo(100,h/2)  
lineTo(0,h/2)  
lineTo(0,-h/2)  
endFill();  
}  
this.x1 = \_root.\_xmouse;  
this.y1 = \_root.\_ymouse;  
this.lc.\_x = this.x1;  
this.lc.\_y = this.y1;  
this.x2 = this[‘l’+(this.a-1)].\_x == undefined ? \_root.\_xmouse : this[‘l’+(this.a-1)].\_x;  
this.y2 = this[‘l’+(this.a-1)].\_y == undefined ? \_root.\_ymouse : this[‘l’+(this.a-1)].\_y;  
this.lx = this.x1 - this.x2;  
this.ly = this.y1 - this.y2;  
this.rotation = Math.atan2 (this.lx,this.ly);  
this.rotation _= 180/Math.PI;  
this.lc.\_rotation = 270-this.rotation;  
this.lc.\_xscale = Math.sqrt(this.lx_this.lx+this.ly\*this.ly)+1;  
\_root.foo.img.setMask(\_root.mask);  
updateAfterEvent();  
}  
\_root.foo.\_visible = 1  
}

mask.onMouseUp = function()  
{  
this.a++  
this.onMouseMove = undefined;  
}

foo2.\_alpha = 20  
this.onMouseMove[/COLOR]

I would gracefully appreciate any help as this is starting to drive me nuts…  
/Simon
