Skip to main content
September 4, 2007
Answered

Need help unrotating a Movie Clip

  • September 4, 2007
  • 3 replies
  • 277 views
So in actionscript 3.0 I have a movie clip. I 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?
This topic has been closed for replies.
Correct answer clbeech
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;
}
}

3 replies

clbeech
Inspiring
September 4, 2007
no sweat, you're welcome :)
September 4, 2007
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!!!
clbeech
clbeechCorrect answer
Inspiring
September 4, 2007
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;
}
}