Tween help!

I wrote down the very first word for this thread and realized that I was forgetting one simple fact, so I will account this story for you anyway in hopes that someone will not make this mistake again.

In AS 2.0, you were allowed to invoke a Tween’s onMotionFinished event as a function, thus something as follows:


var myTween = new Tween(myObj, "alpha", Strong.easeOut, 100, 0, 10, false);
myTween.onMotionFinished=function(){
trace("the tween has been done, master");
}

My question was along the lines of how do I invoke this while I’m using AS 3.0? I kept using this:


myTween.motionFinish=function(){
}

and for obvious reasons coming to a failing argument. Thus I remembered that you can’t call events like this anymore!

So the fix is something as follows:


var myTween = new Tween(myObj, "alpha", Strong.easeOut, 100, 0, 10, false);
myTween.addEventListener("motionFinish", finishFunc);

Which would call this function:


function finishFunc(e:Event){
trace(e.target.obj.alpha);
}

The e.target.obj, of course, in reference to the myObj that we put in as our obj in the original Tween.

Anyway, that’s there for anyone who was curious :slight_smile: