# Confining a rotation to a specific range

**URL:** <https://forum.kirupa.com/t/confining-a-rotation-to-a-specific-range/188812>\
**Category:** flash\
**Created:** [May 11, 2006, 12:35am UTC](https://forum.kirupa.com/t/confining-a-rotation-to-a-specific-range/188812 "2006-05-11T00:35:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hausnfranz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hausnfranz/32/2427_2.png) [@Hausnfranz](https://forum.kirupa.com/u/Hausnfranz)\
**Post date:** [May 11, 2006, 12:35am UTC](https://forum.kirupa.com/t/confining-a-rotation-to-a-specific-range/188812/1 "2006-05-11T00:35:16Z")

</div>

Hi all,

I have a ‘plus’ and ‘minus’ button that rotates a dial (.hand). The code below belongs to the minus button.

I trace the position and I want the dial to not go past a position of 40, how can I set this up? The dial can still move in the positive direction, however.

Also, when the dial reaches a certain positive position, I want the entire movie to jump to another frame, (to an area with a different dial), and the dial reset itself to its origianl (symbol) position.

on (press) {  
\_root.hand.\_rotation -= 5 \* direction;  
trace(\_root.hand.\_rotation);  
}

Here is an attempt, but I cant seem to get everything correct:

//on (press){  
//if (\_root.hand.\_rotation = -40){  
//\_root.hand.\_rotation = false

```
//} else {
    
//_root.hand._rotation -= 5 * direction;
//trace(_root.hand._rotation);

```

//}  
//}

Thanks for any corrections!
