-
Mouse tracking help
I have a movieclip on the stage that's acting as a mask with an instance name of 'mask_mc'. It's a 160x600 box.
I would like to have an onEnterFrame function, that tracks the mouse's Y position and sets mask_mc to that position value minus 160 (so the bottom of my mask lines up with the mouse).
I also was wondering if there's a way to track when the mouse has left the stage, and if so, have it automatically set the mask_mc to a given position, [0,-279].
-
I figured out how to get the mc to follow my cursor with this code...
Code:
this.onMouseMove = function() {
this.mask2_mc._y=_root._ymouse-600;
this.stripe_mc._y=_root._ymouse;
//trace(_root._ymouse);
updateAfterEvent();
};
Now I need to have the mc's snap back to a given spot when the user mouses out. Any help there?
-
You can't check if mouse has left screen in Actionscript 2.0, only in Actionscript 3.0
-
Put an empty movieclip on the bottom layer, and put an on enterFrame with an onRollOut=function(){
//Mouse is out of the movieclip, therefore is out of the stage, DO THIS
}
and onRollOver=function(){
//Mouse is over the movieclip, therefore is inside the stage, DO THIS
}
*I have not tested it, but it sh ould work.