| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Mar 2001
Posts: 26
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
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
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Mar 2001
Posts: 26
|
Hey Jesse thnx alot for the script, i've been trying to figure it out for days. I really appreciate it, Thanks
![]() Cheers |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Aug 2007
Posts: 1
|
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! Last edited by Riot; 08-17-2007 at 05:30 PM.. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mouse over on dynamically added MovieClip | vikasumit | Components | 16 | 08-17-2007 03:32 AM |
| How do I get a movieclip to react to the mouse within a certain area? | Shaun-Optimus | ActionScript 2.0 | 16 | 06-22-2007 02:31 PM |
| Respond to mouse events inside a movieclip that has mouse events... | mrand01 | ActionScript 2.0 | 1 | 07-28-2006 07:10 PM |
| a quickie - need name of movieclip that mouse is over | kubicka | ActionScript 2.0 | 4 | 01-21-2006 02:00 AM |
| Mouse and Any MovieClip Collision Detection | pixelwit | ActionScript 1.0 (and below) | 5 | 12-16-2001 06:15 PM |