# Rotate a movieclip from its center

**URL:** https://forum.kirupa.com/t/rotate-a-movieclip-from-its-center/301082
**Category:** Uncategorized
**Created:** [December 3, 2009, 8:47am UTC](https://forum.kirupa.com/t/rotate-a-movieclip-from-its-center/301082 "2009-12-03T08:47:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![black\_pearl](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@black\_pearl](https://forum.kirupa.com/u/black_pearl)
#### Post date: [December 3, 2009, 8:47am UTC](https://forum.kirupa.com/t/rotate-a-movieclip-from-its-center/301082/1 "2009-12-03T08:47:29Z")

</div>

I want to rotate a movieclip depending upon the mouse movement. Rotation is working also but I want to rotate it from the center of the movieclip. The registration point of the movieclip is top - left

Code

```auto
var radiance:Number = 180/Math.PI;
_root.onEnterFrame = function() 
{

        //calculate rotation
        walkdirection = -(Math.atan2(_xmouse-box_mc._x, _ymouse-box_mc._y))*radiance;
        //set rotation
        box_mc._rotation = walkdirection;

}

```

I cannot figure out how to do this ☹
