Problem with easing

I have a movie

when i press button 1 , i want the picture to move accross to a certain x co-ordinate, and i want it to ease there, so it goes smoothly.

The problem is that when i click on button 1 it doesn’t seem to move anything. I’ve attached the fla, I’d be grateful if anyone could help.

This is the sort of effect i want

http://www.emilianorodriguez.com.ar/

well the reason why button 1 doesnt work is because on the decks clip you loaded it on _x = 100 and your button brings it to the same _x = 100. The button works, but just not the way you wanted. Also on button 2 you should change the _x = 250 to _root.decks._x = 250. Your current code moves the whole stage to 250.

For the easing question, you should do a search for some easing functions. Easing is done usually done with onClipEvent(enterFrame) type of code. Just do a search with easing and you’ll find plenty of info.

I only have MX so I can’t look at your file, but have you tried Voetsjoeba’s golden formula?


 MovieClip.prototype.easeX = function(to){
 this.onEnterFrame = function(){
 this._x = to-(to-this._x)/1.1;
 if(this._x > to-1 && this._x < to+1){
 this._x = to;
 delete this.onEnterFrame
 //do other stuff here, this is the point at which the object reaches its target
 }
 }
 }
 MC.easeX(100);

and for movement in the x, y direction:


MovieClip.prototype.ease = function(x,y){
  this.onEnterFrame = function(){
     this._x = x-(x-this._x)/1.1;
     this._y = y-(y-this._y)/1.1
     if(this._x > x-1 && this._x < x+1 && this._y > y-1 && this._y < y+1){
      this._x = x;
      this._y = y;
      delete this.onEnterFrame

      //do other stuff here, this is the point at which the object reaches its target
                 }
         }
 }

 MC.ease(100,100);

 

:hr: