# Stopping rotation at a set angle

**URL:** https://forum.kirupa.com/t/stopping-rotation-at-a-set-angle/89018
**Category:** flash
**Created:** [May 4, 2005, 11:33am UTC](https://forum.kirupa.com/t/stopping-rotation-at-a-set-angle/89018 "2005-05-04T11:33:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pastey](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@pastey](https://forum.kirupa.com/u/pastey)
#### Post date: [May 4, 2005, 11:33am UTC](https://forum.kirupa.com/t/stopping-rotation-at-a-set-angle/89018/1 "2005-05-04T11:33:59Z")

</div>

I have 2 objects on stage, pane (which rotates) and topbut (which initiates the rotation)

Currently onRollOver of topbut rotates pane indefinitely, what I’d like it to do is stop once the rotation has gone through 180 degrees.  
Here’s the AS, any pointers in the right direction would be appreciated.

Thanks,  
pwb.

[AS]var angle:Number = 180;  
\_root.createEmptyMovieClip(“temp”, \_root.getNextHighestDepth());  
rotapos = function (movie, angle) {  
temp.onEnterFrame = function() {  
movie.\_rotation += 10;  
if (movie.\_rotation\<=angle) {  
delete rotapos;  
}  
};  
};  
topbut.onRollOver = function() {  
\_root.rotapos(pane, angle);  
trace(angle);  
};  
[/AS]
