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

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. 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!

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.


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);