# AS2 drag and rotate handle with limited range

**URL:** <https://forum.kirupa.com/t/as2-drag-and-rotate-handle-with-limited-range/332017>\
**Category:** flash\
**Created:** [December 30, 2013, 11:58pm UTC](https://forum.kirupa.com/t/as2-drag-and-rotate-handle-with-limited-range/332017 "2013-12-30T23:58:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamidasim](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@hamidasim](https://forum.kirupa.com/u/hamidasim)\
**Post date:** [December 30, 2013, 11:58pm UTC](https://forum.kirupa.com/t/as2-drag-and-rotate-handle-with-limited-range/332017/1 "2013-12-30T23:58:11Z")

</div>

hi there … i need a simple solution for Senocular’s drag’n’rotate handle sample . I want limited range to rotation only 90 degree angle … or whatever I needed… how can i do this ? I’m not good at code stuff… Thanks already

here is original code from senocular’s sample

handle.grip.onPress = function(){  
// when you press the grip in the handle  
handle.onMouseMove = function(){  
// add a mouse move event to the handle

```
    // get an angle to the mouse using atan2 (gets radians)
    var angle = Math.atan2(this._parent._ymouse-this._y,this._parent._xmouse-this._x);
    // apply rotation to handle by converting angle into degrees
    this._rotation = angle*180/Math.PI;
    // rotate the grip opposite the handle so it won't rotate along with it
    this.grip._rotation = -this._rotation;
}

```

}  
handle.onMouseUp = function(){  
// if a mouse move event, delete it on mouse up  
if (this.onMouseMove) delete this.onMouseMove;  
}
