Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Animation and Effects

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-21-2001, 06:02 AM   #1
solidsnake
Registered User
 
Join Date: Mar 2001
Posts: 26
Unhappy MovieClip to Mouse

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
solidsnake is offline   Reply With Quote
Old 03-21-2001, 08:15 AM   #2
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

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.
Jesse is offline   Reply With Quote
Old 03-22-2001, 02:19 AM   #3
solidsnake
Registered User
 
Join Date: Mar 2001
Posts: 26
Smile Thanks Jesse :)

Hey Jesse thnx alot for the script, i've been trying to figure it out for days. I really appreciate it, Thanks

Cheers
solidsnake is offline   Reply With Quote
Old 08-17-2007, 05:22 PM   #4
Riot
Registered User
 
Join Date: Aug 2007
Posts: 1
Red face

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..
Riot is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 09:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.