PDA

View Full Version : Ease Out MovieClip


Festival
06-17-2009, 03:30 PM
I'm currently working on a project involving several button rollover animations. I have a certain button that when you mouse over, the movieclip plays causing a certain part of it to rotate.

Is there any way for me to make it continue to play for about a second or two after you mouse out, but have the animation slowly come to a stop? I've messed with creating a timer and an enter_frame event but haven't gotten anywhere so far.

dcaccavella
06-17-2009, 04:15 PM
Your using MovieClip not button, right? You can just create different animations on separate timeline lengths inside of it, and assign event listeners to jump to and play from that timeline frame.

Example:


this.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
this.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);

function mouseOverHandler(event:MouseEvent):void
{
gotoAndPlay(2);
}

function mouseOutHandler(event:MouseEvent):void
{
gotoAndPlay(10);
}



create the rollover animation from frames 2 - 9 for example, and put a stop() command on frame 9.

create the rollout animation from frames 10 - 18, and put a gotoAndStop(1) command on frame 18.

Festival
06-17-2009, 04:37 PM
The only problem with that is that I need the object to keep rotating when moused over. So if someone took their mouse off at frame 5 during the rollover sequence, there would be a jump to the ease out sequence.

dcaccavella
06-17-2009, 05:05 PM
Aha!. Then actionscript tweening is your solution. you might have to get a little complicated with the actionscriopt, including a variable that listens if an the animation is still going, but the main thing, is a) skip the frames b) use actionscript tweens. Grab the current rotation as the starting point, and the amount the rotate and time in the tween. Look up some documentation on tween and u should be able to figure this out.

does this make sense?

Festival
06-17-2009, 06:05 PM
Yeah, that makes sense. Do you happen to have an example of how I would use the tween class for a movieclip's speed?