# \[Flash8\]Problems trying to get multiple objects to ease and then repeat

**URL:** <https://forum.kirupa.com/t/flash8-problems-trying-to-get-multiple-objects-to-ease-and-then-repeat/248446>\
**Category:** flash\
**Created:** [January 8, 2008, 9:39am UTC](https://forum.kirupa.com/t/flash8-problems-trying-to-get-multiple-objects-to-ease-and-then-repeat/248446 "2008-01-08T09:39:45Z")\
**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 8, 2008, 9:39am UTC](https://forum.kirupa.com/t/flash8-problems-trying-to-get-multiple-objects-to-ease-and-then-repeat/248446/1 "2008-01-08T09:39:45Z")

</div>

Hi, I have been trying to get these two codes to work, I’ve labeled them code 1 and code 2, I am trying to combine the two

-In code 1 I can’t get it to just start without having to click  
-In code 2 I can’t get the object to move in a diagonal point like I can in code 1  
-Overview, I want to combine these two codes so that multiple objects can ease automatically with a (x,y) pause then go to another (x,y) then repeat itself

Please help I’ve practically tore out all my hair already!!!

here’s code1

/\*EASING \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

function ease (object, targetX, targetY, speed) {

```
if(!easingArray) {
    easingArray = [[],[]];
}

var found = false;
for(i=0; i&lt;=easingArray[0].length; i++) {
    if(easingArray[0]* == object) {
        found = true;
        if(easingArray[1]* != object._easing) {
            clearInterval(easingArray[1]*);
            easingArray[1]* = object._easing;
        };
        
        if( (Math.ceil(object._x) &lt; ( Math.ceil(targetX - 1) ) ) || (Math.ceil(object._x) &gt; ( Math.ceil(targetX + 1) ) ) ){
            object._x += (targetX - object._x)/speed;
        } else {
            object._x = targetX;
        };
        if( (Math.ceil(object._y) &lt; ( Math.ceil(targetY - 1) ) ) || (Math.ceil(object._y) &gt; ( Math.ceil(targetY + 1) ) ) ){
            object._y += (targetY - object._y)/speed;
        } else {
            object._y = targetY;
        };
        if( (object._x == targetX) && (object._y == targetY) ) {
            clearInterval(object._easing);
        };
    };
};

if (found == false) {
    var long = easingArray[0].length
    easingArray[0][long] = object;
    easingArray[1][long]= object._easing;
}

```

};

Movieclip.prototype.easing = function (targetX, targetY, speed) {  
;  
clearInterval(this.\_easing);  
this.\_easing = setInterval(ease, 40, this, targetX, targetY, speed);  
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

this.btnEase.onRelease = function () {  
//I figured this is where I need to tell it to not click and just play  
MC1.easing (10, 250, 5);  
MC2.easing (250, 250, 5);  
}  
this.btnReset.onRelease = function () {  
//I figured this is where I need to tell it to not click and just play  
MC1.easing (17, 19, 1.5);  
MC2.easing (202, 25.9, 1);  
}

here’s code2

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();

thanks! any help will help!
