PDA

View Full Version : Transitions / Easing Class question



citizen-erazed
March 29th, 2005, 03:15 AM
Hi,
I've been using the easing class in actionscript for most of my animations because its a lot easier to change something later and the files seem to be smaller. I've been coding it mainly like this:

new mx.transitions.Tween (frog, "_alpha", mx.transitions.easing.None.easeNone, 0, 100, 48, false);

My question is this:
When I want some more animation to happen, say, after the 48 frames that fade in the frog (above), I put a keyframe 48 frames after that and write a new transitions tween. Is there a way to code just in one frame and have a counter that will wait say 2 seconds (24fps) and then run a new tween?

MichaelxxOA
March 29th, 2005, 03:35 AM
why not just run a conditional to test where your frog is, then once it get's to where you want it use that to cue the transition, make sense?
-Michael

citizen-erazed
March 29th, 2005, 03:52 AM
Thanks Micheal, that is a good idea. I'm doing it the following way could you suggest an easier way?

in frame 1:
attach the movie clip, place it at X, Y, and start the animation.

in frame 2:
if (frog._alpha==100) {
// do what ever needs to be done
gotoAndPlay (4);
}

in frame 3:
gotoAndPlay (2);

and then the next animation in frame 4.

Is there a way to check in frame 1 without having to jump back to frame 2?

mattyo7
March 29th, 2005, 06:18 AM
Hi,

I've been using the old versions of the tween classes for a while and haven't experimented with the new MX 2004 versions, however they look pretty similar. Therefore I think what you can do is this.

frogFadeIn = new mx.transitions.Tween (frog, "_alpha", mx.transitions.easing.None.easeNone, 0, 100, 48, false);

frogFadeIn.onMotionFinished = function (){

// -- setup new tween in here e.g
// -- frogBounce = new mx.transitions.Tween (frog, "_y", mx.transitions.easing.None.easeInBounce, 0, 100, 48, false);

}

then once your frog fade has finished it will then do the next statement

There are a number of these listeners built into the tween classes. I know a few of them are onMotionStarted, onMotionChanged, onMotionResumed and onMotionFinished.

Hope this helps

citizen-erazed
March 29th, 2005, 06:22 AM
Fantastic! That works like a dream!

Appreciate all the help!