# Custom cursor that points in the direction its heading?

**URL:** <https://forum.kirupa.com/t/custom-cursor-that-points-in-the-direction-its-heading/224133>\
**Category:** flash\
**Created:** [April 28, 2007, 11:39pm UTC](https://forum.kirupa.com/t/custom-cursor-that-points-in-the-direction-its-heading/224133 "2007-04-28T23:39:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shlauncha](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@shlauncha](https://forum.kirupa.com/u/shlauncha)\
**Post date:** [April 28, 2007, 11:39pm UTC](https://forum.kirupa.com/t/custom-cursor-that-points-in-the-direction-its-heading/224133/1 "2007-04-28T23:39:59Z")

</div>

I’ve come really close, but the cursor seems to rotate around the mouse location. The code I’m using is below. Can anybody offer some guidance?

Main Time line:

```auto

active = true;

var mcTargetX:Number;
var mcTargetY:Number;

var velX:Number = 0;
var velY:Number = 0;

this.onEnterFrame = function(){

    if(active){
        
        mcTargetX = _xmouse;
        mcTargetY = _ymouse        

        velX*=0.7;
        velY*=0.7;
        
        differenceX = mcTargetX-cursor_mc._x;     
        differenceY = mcTargetY-cursor_mc._y; 
        
        differenceX*=0.15; 
        differenceY*=0.15; 
        
        velX+=differenceX;
        velY+=differenceY;
        
        cursor_mc._x+=velX;
        cursor_mc._y+=velY;
    }
    
}

mcTargetX = _xmouse;
mcTargetY = _ymouse;

```

cursor\_mc:

```auto
onClipEvent(enterFrame){
    
    dx = _parent._xmouse-_x;
    dy = _parent._ymouse-_y;
    
    angle = Math.atan2(dy, dx);
    
    _rotation = angle * 180/Math.PI;
    
}

```

Thanks for any help!:thumb:

-Dan
