Groups | Blog | Home
all groups > flash actionscript > september 2007 >

flash actionscript : Reversing Animation


DeezNutz215
9/21/2007 3:04:35 PM
Hello everyone. I'm in a little pickle right now. I broke my ankle and cant
get to my office where my actionscript 3.0 book is.

I have a button in an animation that is supposed to reverse the animation when
pressed. What is the function or method that's used to reverse the animation.
My current code only makes the animation stop on the previous frame. What is
the code to make then animation just continuously loop in reverse?

reverseButton.addEventListener ( MouseEvent.CLICK, myReverseHandler )
function myReverseHandler( evt ){
gotoAndStop(currentFrame - 1)
}
kglad
9/21/2007 3:07:23 PM
DeezNutz215
9/21/2007 3:12:03 PM
Thanks for the input. I'm new at Flash, and since i missed my last class due
too injury, I sort of need some coaching as to how to accomplish this. Sorry,
i just dont' have any of my class materials with me and I can't get to my books.

I guess I could use some help with using loops in Flash CS3
kglad
9/21/2007 3:20:30 PM
:



var t:Timer=new Timer(70,0);
t.addEventListener(TimerEvent.TIMER,f,true,0,false);
reverseButton.addEventListener ( MouseEvent.CLICK, myReverseHandler )
function myReverseHandler( evt ){
t.start();
}
function f(evt:TimerEvent){
mc.prevFrame(); // where mc is the movieclip you want to reverse
if(mc.currentFrame==1){
t.stop();
}
}
DeezNutz215
9/21/2007 3:48:25 PM
Thanks kglad! I really appreciate your help. I'm sorry if I'm being a
nuisance, but is the "mc" the name of the file I'm working with. I created the
animation from scratch. I've tried to put in the name of the file in those
areas, and have only received errors. I'm not quite sure what to put into the
"mc" code. I know its supposed to be the name of the clip i'm working with,
but I'm not sure what the name of the movie clip is.
kglad
9/21/2007 3:59:49 PM
DeezNutz215
9/21/2007 4:10:42 PM
I have 3 layers in my Animation. [b]Name, Red Circle, and Buttons[/b]. The
reverse button is on the Buttons Layer. I need the Red Circle Layer to
Reverse. Everything else stays in the same position for the animation except
for the Red Circle Layer.
kglad
9/21/2007 5:11:13 PM
DeezNutz215
9/21/2007 5:19:36 PM
the timeline that I want to reverse is the same as the timeline that contains
the code. I'm not doing anything too complex. when I remove the mc dot
references and test the move, it plays fine, but nothing happens when I press
the "Reverse" button.
kglad
9/21/2007 7:33:42 PM
DeezNutz215
9/21/2007 8:15:12 PM
kglad
9/21/2007 8:15:39 PM
AddThis Social Bookmark Button