views:

91

answers:

1

Hi all. I have a movieclip.

Its current y is 0, and i want to move it to y 100

How im currently doing it is

onenterframe { Y += 2 }

how would i do it that it starts off slow and ends slow but speeds up in the middle?

A: 

There are lots of ways to do this, one way is to use the Tween class that is provided by Adobe (actionscript 2 + 3)

import fl.transitions.Tween;
import fl.transitions.easing.*;

var tween:Tween;
function moveTo(targetY:Number, numberOfFrames:int) {
  tween = new Tween(this, "y", Regular.easeInOut, y, targetY, numberOfFrames);
}

See the flash reference for more info

You can also use just the Regular.easeInOut function in your own onEnterFrame loop, or choose to use one of many community written tween libraries like gTween or TweenLite.

Les