# Counting revolutions of a movie clip

**URL:** <https://forum.kirupa.com/t/counting-revolutions-of-a-movie-clip/327131>\
**Category:** flash\
**Created:** [February 7, 2012, 4:40pm UTC](https://forum.kirupa.com/t/counting-revolutions-of-a-movie-clip/327131 "2012-02-07T16:40:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theMonitor](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@theMonitor](https://forum.kirupa.com/u/theMonitor)\
**Post date:** [February 7, 2012, 4:40pm UTC](https://forum.kirupa.com/t/counting-revolutions-of-a-movie-clip/327131/1 "2012-02-07T16:40:17Z")

</div>

Hi, wonder if anyone is able to help with this one.

I am using the following code (found at [http://www.foundation-flash.com/tutorials/as3rotation/](http://www.foundation-flash.com/tutorials/as3rotation/) - so thanks go to them for that) to rotate a movie clip according to the position of the mouse:

```php

stage.addEventListener(Event.ENTER_FRAME ,rotate);

function rotate(e:Event) {
	
var dX:int = mouseX - theArrow.x;
var dY:int = (mouseY - theArrow.y) * -1;

var rad:Number = Math.atan2(dY,dX); 
var angle:Number = rad*(180/Math.PI); 
	
theArrow.rotation = angle*-1;
	
}

```

What I would like to be able to do is measure one complete (360 degree) revolution of the arrow (clockwise, in this case); and from there, count and/or time the revolutions.

But the first step is to detect one complete revolution. Could anyone give some hints as to how that could be achieved?
