# How could I get an arrow to follow a movie clip?

**URL:** <https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132>\
**Category:** flash\
**Created:** [May 25, 2002, 10:05am UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132 "2002-05-25T10:05:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 10:05am UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/1 "2002-05-25T10:05:18Z")

</div>

Is there anyway to make an arrow point to a moving movie clip, besides moving the arrow every frame?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 10:06am UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/2 "2002-05-25T10:06:10Z")

</div>

Umm…give more detail…Im not 100% sure what you mean.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 10:09am UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/3 "2002-05-25T10:09:00Z")

</div>

like a little moving movie clip… lets use ‘~’ for now… then there would be an arrow at the bottom of the movie, and as ‘~’ moved, the arrow would keep pointing to it.

[edit=oops, it didnt save the spaces…]  
something like that…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 10:10am UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/4 "2002-05-25T10:10:22Z")

</div>

just thought of a good way to explain it…  
its like those movies that have the eyes following your cursor, but I want the eyes to be an arrow, and follow a movie clip instead…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 1:12pm UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/5 "2002-05-25T13:12:48Z")

</div>

You get the angle between your clip and the clip you want to follow (with Math.atan2) and then you set the angle. If you know your trigonometry, it’s a walk in the park.

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 3:47pm UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/6 "2002-05-25T15:47:27Z")

</div>

heh… sorry, Im just now passing Pre-Algebra (7th Grade)… can someone explain to me in a little more detail? :lol:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 4:41pm UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/7 "2002-05-25T16:41:17Z")

</div>

Something like in there : [pub40.ezboard.com/fkirupa…3331.topic](http://pub40.ezboard.com/fkirupafrm8.showMessage?topicID=3331.topic)

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 5:15pm UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/8 "2002-05-25T17:15:49Z")

</div>

hmmm… still doesnt seem to like me… any chance someone could try and make a .fla where it follows a clip instead of the mouse… or make it follow the mouse and explain how to make it follow the clip :lol:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 5:41pm UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/9 "2002-05-25T17:41:30Z")

</div>

Ok, here’s what you need : in the first frame of your animation

```auto
 MovieClip.prototype.follow = function (destx,desty) {
&nbsp &nbsp &nbsp &nbsp // destx is the x coordinate of what you want to follow
&nbsp &nbsp &nbsp &nbsp // same for y
&nbsp &nbsp &nbsp &nbsp var distx = destx - this._x ;
&nbsp &nbsp &nbsp &nbsp var disty = desty - this._y ;
&nbsp &nbsp &nbsp &nbsp var angle = Math.atan2(disty,distx) ; //angle in radians
&nbsp &nbsp &nbsp &nbsp angle *= 180/Math.PI ; //angle in degrees
&nbsp &nbsp &nbsp &nbsp this._rotation = angle ;
}

```

Then if you want a movie clip to follow the mouse, it’s

```auto
 onClipEvent (enterFrame) {
&nbsp &nbsp &nbsp &nbsp follow (_root._xmouse,_root._ymouse) ;
}

```

If you want it to follow the clip \*\* guide\*\* that is in \_root, it will be

```auto
 onClipEvent (enterFrame) {
&nbsp &nbsp &nbsp &nbsp follow (_root.guide._x,_root.guide._y) ;
}

```

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2002, 9:27pm UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/10 "2002-05-25T21:27:37Z")

</div>

got it to work!! 😃 Thanks pom 😃

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2002, 10:08am UTC](https://forum.kirupa.com/t/how-could-i-get-an-arrow-to-follow-a-movie-clip/2132/11 "2002-05-26T10:08:08Z")

</div>

Prototypes rock, don’t they ?? 😃

pom 0]
