|  | Smooth Movie Clip Movements on Rollover? |  | |
| | | charner |  |
| Posted: Fri May 23, 2008 7:48 pm Post subject: Smooth Movie Clip Movements on Rollover? |  |
I've been trying to figure out how to simply make movie clips nudge/move slightly to the right or left (doesn't even need to be a random movement, but that would be great too) and then return to the original place. I would like to have easing in that, not a sharp movement. Right now, I am using a tween code (import mx.transitions.Tween; import mx.transitions.easing.* but it won't allow me to start from one point, bounce/elastic (whatever) to another point and then ease right back. It only bounces TO another place. I want something that is almost like a mild repellent of the mouse or something. Any ideas?
Thanks, Christy |
| |
| | | charner |  |
| Posted: Fri May 23, 2008 8:31 pm Post subject: Re: Smooth Movie Clip Movements on Rollover? |  |
Skip the last part about the "mild repellent of the mouse". Come to think of it, that would actually be a bad thing!
Christy |
| |
| | | clbeech |  |
| Posted: Fri May 23, 2008 10:44 pm Post subject: Re: Smooth Movie Clip Movements on Rollover? |  |
you must have been doing some reading to use the methods you have mentioned - so look into the onMotionFinished handler and the yoyo methods - you could use these to play the tween in reverse once the first tween is finished, as in:
var xp = Math.round(Math.random()*10); var tw = new Tween(obj, '_x', Elastic.easeOut, obj._x, obj._x+xp, 10, false); tw.onMotionFinished = function() { tw.yoyo(); } |
| |
| | | charner |  |
| Posted: Mon May 26, 2008 2:59 pm Post subject: Re: Smooth Movie Clip Movements on Rollover? |  |
Thanks. I'd tried a bit of onMotionComplete before, but nothing worked. I played around with it more since you suggested it and finally figured it out. I guess you just have to play around with the code for a bit to get something that looks realistic! My final code (in case anyone in the world actually cares!) was:
myBall1_mc.onRollOver = function() { var myHoriTween1:Tween = new Tween(myBall1_mc, "_x", Regular.easeInOut, 100, 120,.5, true); myHoriTween1.onMotionFinished = function (){ var myHoriTween1a:Tween = new Tween(myBall1_mc, "_x", Elastic.easeOut, 120, 100, 2, true); } };
Thanks again Christy |
| |
|
|