dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to do make movieclip follow mouse tween movement?

  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    48

    How to do make movieclip follow mouse tween movement?

    Hello,

    I'm not sure what to call this particular way of making the movieclip follow the mouse.

    Here's an example animation to show what I mean: http://www.swfcabin.com/open/1307994341

    When the mouse moves up, the movieclip plays through the frame. If the mouse moves down, the movieclip plays in reverse? I think that's how it works. Can someone help me with the codes?

  2. #2
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    Your going to need to use the _y coordinates of the mouse to control the clip. You'll have to find a range of how high to how low the animation goes in relation to the _y. It could be as simple as if the pointers _y position is below the value of 50 and above 250 you could start rotating your ax graphic inside of a movieclip. And make the axes rotation point at the bottom of the ax.

    I think this would give you the effect your looking for, and be better then trying to make the animation play back and forth.

    How good are you at coding?

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    48
    I managed to do it by manipulating the movieclip's frames using the gotoAndStop code. It's not elegant but it worked the way I wanted it. I found codes for frame by frame mouse movement in google and tweaked it a little to do this:

    http://www.swfcabin.com/open/1308076340

    Code:
    stop();
    
    axe_mc.stop();
    
    axe_mc.onMouseMove = function()
    {
    	if (hit_mc.hitTest(_root._xmouse, _root._ymouse, true))
    	{
    		this.gotoAndStop(Math.ceil(hit_mc._ymouse / 8));
    		updateAfterEvent();
    	}
    };
    I don't really know what does what. Anyone care to try to explain the code? And if you have a different way of doing things, I'd sure like to know it. So I can expand my knowledge of actionscripting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center