# Easing functions not executing simultaneously

**URL:** <https://forum.kirupa.com/t/easing-functions-not-executing-simultaneously/214754>\
**Category:** flash\
**Created:** [January 31, 2007, 7:21pm UTC](https://forum.kirupa.com/t/easing-functions-not-executing-simultaneously/214754 "2007-01-31T19:21:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shane\_c](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@shane\_c](https://forum.kirupa.com/u/shane_c)\
**Post date:** [January 31, 2007, 7:21pm UTC](https://forum.kirupa.com/t/easing-functions-not-executing-simultaneously/214754/1 "2007-01-31T19:21:19Z")

</div>

I’m making a little movie where, when a button is clicked, a swf file is loaded into a movie clip using the MovieClipLoader object, and on the onLoadInit event, the clip’s alpha and \_x are both eased using custom prototype methods. When I first test the movie, it works fine - it fades/moves in correctly. If I click the button while it’s still easing, it again reloads and looks fine - but for some reason, once I wait for it to fully ease in, when I click the button, it first loads, then the Alpha eases up to 100, and THEN it eases to the \_x… I can’t figure out why this is happening this way. Any ideas? Thanks!

My AS for the button is:

```auto
button.onRelease = function() {
    tip2._alpha = 0;
    tip2._rotation = 90;
    tip2._x = 700;
    tlistener = new Object ();
    tlistener.onLoadInit = function () {
        tip2.easeX(565, .5);
        tip2.AlphaUp(5, 100);
    }
    tip2_mcl = new MovieClipLoader ();
    tip2_mcl.addListener (tlistener);
    tip2_mcl.loadClip ("---url----", tip2.tip2swf);
}

```

And the easing functions are from the Easing AS tutorial on this site:

```auto
MovieClip.prototype.AlphaUp = function(speed:Number, top:Number) {
    var _this:MovieClip = this;
    var aux:MovieClip = _this.createEmptyMovieClip( "alphaUp_aux" , 1221 );
    aux.onEnterFrame = function(){
        if (_this._alpha < top) {
            _this._alpha += speed;
        }
    }
}

MovieClip.prototype.easeX = function( to:Number , speed:Number , endF:Function , endO , endP:Array ){
    
    var _this:MovieClip = this;
    var aux:MovieClip = _this.createEmptyMovieClip( "easeX_aux" , 1223 );
    var previousPosition:Number = this._x;
    
    if( isNaN(speed) || speed == undefined || speed == '' || speed <= 1 ) speed = 1.2;
    
    if( _this._x != to ){
    
        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 );
    }
    
}

```
