# Of mouses and masks

**URL:** <https://forum.kirupa.com/t/of-mouses-and-masks/12811>\
**Category:** flash\
**Created:** [February 4, 2003, 11:39pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811 "2003-02-04T23:39:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![CLoudStrife](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@CLoudStrife](https://forum.kirupa.com/u/CLoudStrife)\
**Post date:** [February 4, 2003, 11:39pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/1 "2003-02-04T23:39:21Z")

</div>

whats the command to get a mask to follow the mouse?  
Someone help.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 12:29am UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/2 "2003-02-05T00:29:48Z")

</div>

I sometimes use:

First Frame  
difference = \_xmouse - arrow.\_x;  
arrow.\_x = arrow.\_x + (difference/delay);  
menu.\_x = - arrow.\_x;

Second frame  
prevFrame();  
play();

Works for me

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 1:04am UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/3 "2003-02-05T01:04:34Z")

</div>

nice subject 😉 I still havent fully gotten through the book heh.

for a steady, exact with the mouse follow use:

```auto

mask_mc.onMouseMove = function(){
	this._x = this._parent._xmouse;
	this._y = this._parent._ymouse;
	updateAfterEvent();
}

```

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 4:36pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/4 "2003-02-05T16:36:04Z")

</div>

thanks! ill see if it works and get back to you…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 9:26pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/5 "2003-02-06T21:26:41Z")

</div>

Wait hold on…

My mask’s instance name is mask  
My movie clip instance name is dancer.

Senocular… could you put those into the lines of code you gave me?

Im kind of stuck.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 10:22pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/6 "2003-02-06T22:22:46Z")

</div>

haha ok, without using a mask layer, have:

```auto

dancer.setMask(mask);
mask.onMouseMove = function(){
	this._x = this._parent._xmouse;
	this._y = this._parent._ymouse;
	updateAfterEvent();
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 10:40pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/7 "2003-02-06T22:40:25Z")

</div>

ok

let me try it

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 10:43pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/8 "2003-02-06T22:43:45Z")

</div>

when i test the movie… it gives me an output menu saying:  
Scene=Scene 1, Layer=man, Frame=1: Line 1: Statement must appear within on/onClipEvent handler  
dancer.setMask(mask);

Scene=Scene 1, Layer=man, Frame=1: Line 2: Statement must appear within on/onClipEvent handler  
mask.onMouseMove = function(){

whats wrong?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 11:26pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/9 "2003-02-06T23:26:30Z")

</div>

heres what i have so far… but i dont know why the crosshairs arent working on the mask…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 11:39pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/10 "2003-02-06T23:39:13Z")

</div>

here i fixed a part  
added some text

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 11:45pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/11 "2003-02-06T23:45:13Z")

</div>

a mask masks. You dont see a mask. Thats why the white cirlce goes away. it becomes the mask. You dont see the crosshairs because thats part of the mask. IF you want crosshairs, make them a seperate clip on the maintimeline and give them the same code as the mask so they follow the mouse.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 11:48pm UTC](https://forum.kirupa.com/t/of-mouses-and-masks/12811/12 "2003-02-06T23:48:48Z")

</div>

a seperate movie clip for the crosshairs?

ok… ill try it and talk to you tommorow.  
g2g  
bye
