# Need help making the object move diagonally

**URL:** <https://forum.kirupa.com/t/need-help-making-the-object-move-diagonally/248736>\
**Category:** Uncategorized\
**Created:** [January 11, 2008, 5:08am UTC](https://forum.kirupa.com/t/need-help-making-the-object-move-diagonally/248736 "2008-01-11T05:08:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wyz1](https://avatars.discourse-cdn.com/v4/letter/w/ccd318/32.png) [@wyz1](https://forum.kirupa.com/u/wyz1)\
**Post date:** [January 11, 2008, 5:08am UTC](https://forum.kirupa.com/t/need-help-making-the-object-move-diagonally/248736/1 "2008-01-11T05:08:46Z")

</div>

Hi,

Can someone help me try to make this \_x point a (x, y) coordinate and to move in a diagonal direction,…also, how do you make the object pause before repeating the movement???

thanks…code is pasted on the bottom:

MovieClip.prototype.easeX = function(to:Number, speed:Number, endF:Function, endO:Object, endP:Array) {  
if (what.\_x != to) {  
var \_this:MovieClip = this;  
var aux:MovieClip = this.createEmptyMovieClip(“aux\_easeX”, 1337);  
var previousPosition:Number = this.\_x;  
if (isNaN(speed) || Number(speed) !== speed || speed\<=1) {  
speed = 1.2;  
}  
aux.onEnterFrame = function() {  
\_this.\_x = to-(to-\_this.\_x)/speed;  
if (\_this.\_x == previousPosition) {  
\_this.\_x = to;  
this.removeMovieClip();  
if (endF) {  
endF.apply(endO, endP);  
}  
}  
previousPosition = \_this.\_x;  
};  
} else {  
if (endF) {  
endF.apply(endO, endP);  
}  
}  
};  
var startX:Number = myMovieClip.\_x;  
var endX:Number = startX+400;  
chain = function () {  
myMovieClip.easeX(endX, 1.2, myMovieClip.easeX, myMovieClip, [startX, 1.4, chain, null, []]);  
};  
chain();
