PDA

View Full Version : MovieClip to Mouse


solidsnake
03-21-2001, 05:02 AM
Hi all, please forgive me for my ignorance but can someone tell me how to script a MC move to your mouse position? here's the catch i want the MC movement to begin fast and slow down at the end before completely stopping. Any suggestions and comments would be greatly appreciated, tia.
here's an example http://phenomenon.org/intense/

cheers

Jesse
03-21-2001, 07:15 AM
Simplest way is:
creat an MC and put these actions on it

onClipEvent (enterFrame) {
if (_root.target._x+(_root._xmouse-_root.target._x)/2>(0+_root.vrule_mc._width/2) && _root.vrule_mc._x+(_root._xmouse-_root.vrule_mc._x)/2<(550-_root.vrule_mc._width/2)) {
_root.target._x = _root.target._x+(_root._xmouse-_root.target._x)/2;
_root.target._y = _root.target._y+(_root._ymouse-_root.target._y)/2;
}
}


name the clip you want to follow your mouse 'target' (or chage the code appropriately)

This also has a clause to stop the clip going off the screen so you'll need to adapt the 550 value to the width of your presentation.

Cheers

Jesse

solidsnake
03-22-2001, 01:19 AM
Hey Jesse thnx alot for the script, i've been trying to figure it out for days. I really appreciate it, Thanks :)

Cheers

Riot
08-17-2007, 04:22 PM
I am trying to get this script to work, but no luck. I am using flash 8 so I changed the onClipEvent (enterFrame) to onEnterFrame = function () Now that may not be what needed to be done, but figured I would try.

Any help would be great, I am trying to have a mc behind a mask move with the mouse and this sounded like what I was trying to do.

Thanks!