# Tween movement using AS

**URL:** <https://forum.kirupa.com/t/tween-movement-using-as/206612>\
**Category:** flash\
**Created:** [November 9, 2006, 8:32pm UTC](https://forum.kirupa.com/t/tween-movement-using-as/206612 "2006-11-09T20:32:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musashi9](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@musashi9](https://forum.kirupa.com/u/musashi9)\
**Post date:** [November 9, 2006, 8:32pm UTC](https://forum.kirupa.com/t/tween-movement-using-as/206612/1 "2006-11-09T20:32:28Z")

</div>

I want to move a movie clip from startx and starty to endx and endy using AS  
but have it calculate the smallest distance and move the MC at a set speed accordingly so both X and Y stop in the right place at the same time.

in other words i want a small script to act like i have just tweened a MC  
Tween:  
MC \_X=0  
MC \_Y=0  
Create Motion tween on frame 0  
move on 50 frames  
Create Motion tween on frame 50  
set the \_X from 50 to 100  
set the \_Y from 50 to 200  
play()

The movie clip moves to frame 50 but the \_X moves at a slower speed than the Y because it has less distance to travel

can someone show me how this is done in AS  
with a startX of 0 and a startY of 0  
end X of 100 and an end Y of 200
