# Tween animation

**URL:** <https://forum.kirupa.com/t/tween-animation/182376>\
**Category:** Uncategorized\
**Created:** [March 17, 2006, 4:07pm UTC](https://forum.kirupa.com/t/tween-animation/182376 "2006-03-17T16:07:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)\
**Post date:** [March 17, 2006, 4:07pm UTC](https://forum.kirupa.com/t/tween-animation/182376/1 "2006-03-17T16:07:39Z")

</div>

hi,

using AS tween animation, I need to know that a certain mc reach the end of the animation, how can i do this?

I could make a enterFrame check for the value of the animation…for example, if mc.\_x = 300 this would do…but if I’ve 50 mc that could be cpu intensive… any clues?!

.am

---

<div class="post-metadata">

**Author:** ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)\
**Post date:** [March 20, 2006, 12:47pm UTC](https://forum.kirupa.com/t/tween-animation/182376/2 "2006-03-20T12:47:30Z")

</div>

hey,  
sorry for the delay but i was out this weekend, thanks for the reply, by the way  
creatify, o k it works that way, but i’m was trying something shorter when calling the function, but know i don’t know how to concatenate this piece of code

function movon (\_from) {  
var areaA1:Tween = new Tween (main, “\_x”, Strong.easeInOut, [“main.coord”+\_from], -main.coordA2.\_x, 3, true);

when calling the function just want to say  
movon(A1)  
so the result would be  
main.coordA1.\_x  
how can i do this?  
🙂

am

---

<div class="post-metadata">

**Author:** ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)\
**Post date:** [March 20, 2006, 5:20pm UTC](https://forum.kirupa.com/t/tween-animation/182376/3 "2006-03-20T17:20:36Z")

</div>

So you want to move the coord’s depending on which one you pass? Try [AS]function movon (vfrom:String) {  
var areaA1:Tween = new Tween (main, “\_x”, Strong.easeInOut, main[“coord”+vfrom].\_x, -main.coordA2.\_x, 3, true);  
}[/AS] So, [AS]movon(“A1”);[/AS] would move main MC from main.coordA1.\_x to -main.coordA2.\_x. You could, however, modulize it further and have more properties passed to the function like: [AS]MovieClip.prototype.tweenTo = function(vfrom:String, vto:String, dur:Number) {  
var areaA1:Tween = new Tween (this, “\_x”, Strong.easeInOut, main[“coord”+vfrom].\_x, main[“coord”+vto].\_x, dur, true);  
}

main.tweenTo(“A1”,“A2”,3);[/AS]
