# MX 2004 Questions: How do I track the mouse cursor?

**URL:** <https://forum.kirupa.com/t/mx-2004-questions-how-do-i-track-the-mouse-cursor/56222>\
**Category:** flash\
**Created:** [July 1, 2004, 6:09pm UTC](https://forum.kirupa.com/t/mx-2004-questions-how-do-i-track-the-mouse-cursor/56222 "2004-07-01T18:09:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![onebrightlight](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/onebrightlight/32/619_2.png) [@onebrightlight](https://forum.kirupa.com/u/onebrightlight)\
**Post date:** [July 1, 2004, 6:09pm UTC](https://forum.kirupa.com/t/mx-2004-questions-how-do-i-track-the-mouse-cursor/56222/1 "2004-07-01T18:09:30Z")

</div>

Hey all, first time posting on here, though I’ve read through the site quite a bit before.

Anyways, I’m working on a button navigation system that drops down to reveal sub menu buttons underneath, e.g. what you can see at [http://www.kurani.com](http://www.kurani.com). I’ve succesfully managed to get the window to drop down, but I can’t attach code to the original button, as it is now hidden.

What I was thinking of doing is setting an actionscript to the frame itself, stating “If the mouse cursor leaves the confines of coordinates x,y: 0,0 to 180,75 , advance to the next frame.”

If this isn’t making any sense, please let me know, and I’ll try to reword it as well as I can.

Thanks again!

---

<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:** [July 2, 2004, 6:51pm UTC](https://forum.kirupa.com/t/mx-2004-questions-how-do-i-track-the-mouse-cursor/56222/2 "2004-07-02T18:51:52Z")

</div>

eidt: Sorry, after reading your post I realized this isn’t even what you were asking… Heres the code anyway.

Heres one way I came up with… you could probalby store the values using an onEnterFrame instead of setInterval.

```auto

var mp:Array = [];
tmouse = function(){
	mp.push({x:_xmouse, y:_ymouse});
}
trackMouse = setInterval(tmouse, 10);

onMouseDown = function(){
	lineStyle(1,0x000000,100);
	moveTo(mp[0].x, mp[0].y);
	for(var i=0;i<mp.length;i++){
		lineTo(mp*.x, mp*.y);
		moveTo(mp*.x, mp*.y);
	}
	mp.splice(0,mp.length-1);
}
Mouse.addListener(this);

```

(just click after moving the mouse)

I optimized for drawing, so if you don’t want to draw and you just want to store the values, just remove the entire onMouseDown function and Mouse.addListner(this);
