all groups > flash actionscript > september 2007 >
You're in the

flash actionscript

group:

Need help unrotating a Movie Clip


Need help unrotating a Movie Clip Demaestro
9/4/2007 8:10:02 PM
flash actionscript:
So in actionscript 3.0 I have a movie clip. I use add an enter_frame function
to the stage.

Inside of the enter_frame function I call a rotate on the movie clip.

movie_clip_mc.rotate += 45;

When I leave the enter_frame function I want to do something that will make
sure that the movie clip is back to where it was before the rotation was called
on it.

What happens is it ends up turned an extra turn and I want it to stop right
side up...


any suggestions?
Re: Need help unrotating a Movie Clip clbeech
9/4/2007 8:20:13 PM
you need to set up some limits to the rotation within the onEnterFrame, or when
you stop the onEnterFrame you can set the MC rotation back to zero.

example:

onEnterFrame = function() {
if(movie_clip_mc.rotate<360) {
movie_clip_mc.rotate += 45;
}else{
delete onEnterFrame;
movie_clip_mc.rotate = 0;
}
}
Re: Need help unrotating a Movie Clip Demaestro
9/4/2007 8:27:07 PM
thanks clb... I was sure that I had set it to zero... that seemed like the
obvious thing..... It didn't work though... of course only because I was dumb
and copied and pasted it from within my enter_frame function.

So when I tried setting it back it looked like this.

movie_clip_mc += 0;

Of course that didn't work... when you suggested that setting it to zero
should work that is when I took a closer look at my code.

Thanks CLB!!!
Re: Need help unrotating a Movie Clip clbeech
9/4/2007 8:31:19 PM
AddThis Social Bookmark Button