# Check All Points Along a Line?

**URL:** <https://forum.kirupa.com/t/check-all-points-along-a-line/294844>\
**Category:** flash\
**Created:** [August 20, 2009, 8:32pm UTC](https://forum.kirupa.com/t/check-all-points-along-a-line/294844 "2009-08-20T20:32:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jebego](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jebego](https://forum.kirupa.com/u/jebego)\
**Post date:** [August 20, 2009, 8:32pm UTC](https://forum.kirupa.com/t/check-all-points-along-a-line/294844/1 "2009-08-20T20:32:05Z")

</div>

I’m using Flash 8 and AS2

I am attempting to make some code that checks whether or not a line that rotates around the screen is hitting a movie clip. Here is my code (with comments explaining it):

```auto
onClipEvent(enterFrame){
    //center points
    xc = _root.man._x;
    yc = _root.man._y;
    //the angle at where the point on circumfrence is
    a = _root.man.myRadians;
    //length of the line / radius of circle
    r = 181;
    //formula to find the point on circumfrence
    xp = xc + r * Math.cos(a);
    yp = yc + r * Math.sin(a);
    //point to check along the line between the two points
    xnp = xp;
    ynp = yp;
    //if the line is visible (2 is the only frame it is visible on)
    if(_root.man._currentframe == 2){
        //while the point to be checked still isn't the same as the center point
        while(xnp != xc){
            while(ynp != yc){
                //this code makes sure that the while() loop doesn't go on forever by setting a stop point for the minusing of the radius, then printing "No"
                if(r < 0){
                    xnp = xc;
                    ynp = yc;
                    trace("No");
                //if the object hits the certian point we are checking on the line, then it ends the while loop and prints "Yes"
                }if(this.hitTest(xnp, ynp, true)){
                    trace("Yes");
                    xnp = xc;
                    ynp = yc;
                //otherwise, the length of the line is subtraced by 1, so that we can check the next point along the beginning line
                }else{
                    r--;
                }
            }
        }
    }
}

```

Needless to say, it doesn’t work. Basically, I keep getting the print “No” and I don’t know what’s wrong with my code!  
Thanks for the help!
