# PointAtCursor (nested arrows)

**URL:** <https://forum.kirupa.com/t/pointatcursor-nested-arrows/331323>\
**Category:** flash\
**Created:** [July 6, 2013, 5:51pm UTC](https://forum.kirupa.com/t/pointatcursor-nested-arrows/331323 "2013-07-06T17:51:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simranzenov](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@simranzenov](https://forum.kirupa.com/u/simranzenov)\
**Post date:** [July 6, 2013, 5:51pm UTC](https://forum.kirupa.com/t/pointatcursor-nested-arrows/331323/1 "2013-07-06T17:51:01Z")

</div>

I have 1 arrow with 2 arrows inside it. Can anyone tell me how to have all 3 arrows point at the cursor?  
I think I need to into account the angle of the parent or something but I don’t know how to do that ☹

see the attached fla (cs5)

```auto

import flash.events.*;
import flash.display.*;

stage.addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void
{
    PointAtCursor(a1);
    PointAtCursor2(a1.a2);
    PointAtCursor2(a1.a3);
}

function PointAtCursor(obj:MovieClip):void {
        var a:Number = stage.mouseY - obj.y;    
        var b:Number = stage.mouseX - obj.x;
        var angle:Number = Math.atan2(a, b);
        angle = angle * (180 / Math.PI);
        obj.rotation = angle;
}

//for nested objects
function PointAtCursor2(obj:MovieClip):void {
        var a:Number = stage.mouseY - obj.localToGlobal(new Point(obj.x, obj.y)).y;    
        var b:Number = stage.mouseX - obj.localToGlobal(new Point(obj.x, obj.y)).x;
        var angle:Number = Math.atan2(a, b);
        angle = angle * (180 / Math.PI);
        obj.rotation = angle;
}

```

Thanks!! 🙂
