View Full Version : How to detect when mouse rolls out of a movie?
Peoples 08-07-2003, 07:24 PM I've got a .swf file embedded in a html table - my navigation menu is made with flash. Is there a smart way (=actionscript) to control a movieclip in the menu when the mouse moves out of the menu? I have a transparent bar catching up the mouse vertically over the menu links and I would like it to bounce back to the top of the menu if the user takes the mouse away from the menu. Does this make any sense?
I tried to play with the _root._xmouse coordinates so that if they are < 1 or > 119 (my menu is 120 wide) the MC would move back up but it only works if you move the cursor very slowly over the edges. Is there an easy way to detect when the mouse isn't over the swf?
Thanks for any input- I really appreciate all the tips:love:
|
|
ragecgi
08-07-2003, 08:48 PM
--Invisible button over the whole movie controlling your MC?
(obviously the nav buttons themselves would be over it so as not to conflict.)
And add this code to that big invisible button:
on (rollOut, dragOut) {
_root.YOURMOVIECLIP.gotoAndPlay("aFrameLabelInYourMCThatPlaysWhenTheUsersMouserollsOut");
}
If you want it to loop, just have it goto the start Frame Label again.
If you want it to stop, just add a stop action to the last frame of the animation:)
Good luck, and I hope I didn't missunderstand you:)
Peoples
08-08-2003, 08:34 AM
Thanks for the tips - but I still haven't solved the problem. Currently I'm controlling the position of the mouse following transparent bar with actionscript. So the movieclip doesn't have anything in it exept the bar. I control the _y position of the MC like this:
onClipEvent (load) {
_y = 10;
speed = 5;
}
onClipEvent (enterFrame) {
endY = _root._ymouse;
_y += (endY-_y)/speed;
}
So the gotoAndPlay doesn't work unless I make a small animation for the MC to bounce back up. But I want the transparent bar to bounce back up from its current position when the mouse is rolled out of the swf.
This is a bit complicated to explain but anyone feeling like they can help - please do..Thanks :wavey:
CGTalk Moderation
01-15-2006, 08:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.