PDA

View Full Version : Q: detect mouse coordinates, and have multiple MC's react to position


_ele
06-29-2005, 09:14 PM
hello all -

i've been pulling my hair out trying to figure out something.

i have a 2 movieclips that need to gotoAndPlay a certain frame in them depending if the mouse cursor is on the stage or not. Through research, i can see how to find the mouse coords...

_root.bite.onEnterFrame = function (){
trace("x is " + _root._xmouse + " : y is " + _root._ymouse);
}

but then how do i tell an MC to react upon that?
i.e. my stage is masthead banner size, 728x90, so anything above 728x90 or negative coords need to cause movieclips to react.

thanks in advance for any help

- evan

Dylan Marvin
06-29-2005, 10:21 PM
I'm sure there's better ways, but there's always this:

if(_root._xmouse < 0 || _root._xmouse > 728 || _root._ymouse < 0 || _root._ymouse > 90){
something;
}

KEEP IN MIND as far as I know flash doesn't register mouse position outside of the stage on an HTML webpage. Once your mouse rolls over a flash banner flash tracks it, but the point at which the mouse leaves is retained as the mouse's current position (as if your mouse is stuck on the edge).