This content has been marked as final. Show 5 replies
that's not very smooth, so that can be done using an onEnterFrame loop or setInterval() without frequent stage refreshes.
for the easing, you can use a standard ease based on the _xmouse and _ymouse properties. for example:
kglad, thanks a lot for pointing out in this direction. I've been trying to implement something with Robert Penner's tweening classes without any success. This concept works a-ok and I understand your approach perfectly!
If I'd like to affect say 5 objects,
1. How can I create the code for constructing the function without repeating this over and over (object instance name reapeat). Also, changing the easing slightly for each object would be nice also...
2. Would it be problematic if I get rid of the "clearinterval" and let the movie run?
Again, thanks a lot for helping out with an example. It's very appreciated =)
first 2 general comments: 1) if you use setInterval() with a small time parameter (like 2 ms), then you should use updateAfterEvent() in the function being called so the stage updates after the function executes. otherwise, you lose the benefit of those frequent function calls.
2) always use clearInterval() to terminate a setInterval() loop that's no longer needed. and an even better rule-of-thumb is to use clearInterval() even when you don't think a setInterval() has been defined or you think it has already been cleared. ie, you can't use too many clearInterval() statements. they cause no issue when you (try to) clear an interval that doesn't exist. on the other hand, if you ever execute identical setInterval() statements you'll have a mess that cannot be fixed after the duplicate interval is created. (an example is below.)
you can use a similar function, to the above, for any number of movieclips and any number of easing equations. the essential part of the easing equations i used is that the number multiplying yourMC._x plus the number multiplying destX equal 1. that way you can be sure yourMC._x will converge to destX.
with the easing equation you used for yourMC._x, yourMC._x will converge to .8*destX.
anyway, to generalize that code:
the above example and explanation points out exactly what I needed to understand =) This has been a very informative learning thread! Cheers for all your time and patience.