Mouse follow with Multiple MC's



  • 1. ActionScript subtraction error
    Hi all, I don't know if anyone else has had this problem, however, when I perform simple subtraction such as: var tempVal = (1464.85 - 1433.43); instead of getting "31.42", I am getting "31.419999999998". Any other numbers I try work find. Does anyone have any solutions as far as rounding to the nearest hundredth decimal place using AS1 and Flash MX? Is there a function that offers an optional parameter that allows you to round to x decimal places (i.e., anything new in AS2/Flash MX 2004)? Example: Math.round(number, [decimal place]); Thank you in advance for any help. Adam
  • 2. useHandCursor = 0; Not working
    The following script is inside a movie clip as is the object that it refers to, Menu1. The script does not work. When I copy and paste the movie clip into another document, it does work. Can anyone tell me why this might be? Menu1.useHandcursor = 0; Thanks, Tim

Mouse follow with Multiple MC's

Postby LN_DESIGN_STUDIO » Tue, 28 Jun 2005 13:41:41 GMT

Hi, im trying to setup a mouse follow function similar to what is setup on this 
website You will notice how the character on the site 
follows the mouse with different actions (animations) in all 4 directions. I 
need help with the coding on setting that up as I am working on my own 
character for my site. Here is what i have so far for my character but im not 
sure how to edit the code to get my other MC's working with each mouse 
direction.  http://www.**--****.com/ 
appreicated, thanks.

 Here is the actionscript i am using at the moment

 if (_root._xmouse>_level0.stance1._x) {
     _level0.stance1._x = (_level0.stance1._x+4);
 } else {
     _level0.stance1._x = (_level0.stance1._x-4);

Re: Mouse follow with Multiple MC's

Postby LB Back » Tue, 28 Jun 2005 18:21:13 GMT

Not very original is it, to copy that?

 As you're already checking wheather the  _xmouse is greater or smaller than 
the stance1 _x you can also kinda flip stance1 horizontally. Or easier; create 
two instances of the knight (one flipped horizontally) and put them on seperate 
frames in movieclip stance1. Then with your if/else statement  choose either 
frame 1 or frame 2 of movieclip stance1

Similar Threads:

1.MC stop following mouse once clicked or!!please help

I have an MC acting as a button...that follows the mouse...i need the MC to stop following the mouse once clicked or when it reaches frame 8 within the MC...heres my follow code:

onClipEvent (load) {
	_x = 0;
	_y = 0;
	speed = 21;
onClipEvent (enterFrame) {
	endX = _root._xmouse;
	endY = _root._ymouse;
	_x += (endX-_x)/speed;
	_y += (endY-_y)/speed;

2.Making a MC follow the mouse

3.Buttons disabling when Another mc follows mouse.

I have a flash document where there is a line that follows the mouse on the x 
axis between 50 and 490.  When the clip is following the mouse, the buttons 
that i have on the stage are then disabled, and no longer are seen as instances 
of buttons. Is this a problem with my coding (which it most likely is)?  

 Attached is code.

 onClipEvent (enterFrame) {
 	startDrag(this, true, 50, 50, 490, 50);

4.mouse scripting (object to follow mouse(cursor))


 hey guys, looking for some help on how to script or create an animation in 
flash.....basically wanting to put an object onto the page , when the cursor 
moves in different directions , (left right , up and down) i am trying to make 
the object follow the cursor, not to attach the cursor to the object , but for 
the object to follow the cursor.....when a button is clicked then the object 
stops in the position last left.... any misunderstandings please e-mail me but 
your help is most appreciated , thank you...!!



5.Text following mouse on mouse over

6. How to make a MC follow a MC?

7. Changing MC's level on mouse events...pls help

8. on roll over I have an mc follow the mouse, how do i send the mc back ...

Return to FLASH


Who is online

Users browsing this forum: No registered users and 1 guest