Confining a rotation to a specific range

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!