Top tip: For things like this it's a mathematical thing and not a programming language thing, so you should be able to get a tutorial in any programming language and convert the math into the language you're using.
For example, here is a line to circle hit testing function I found with a google search written in C.
bool CircleSegmentIntersect(Vector C, float r, Vector A, Vector B, Vector& P)
{
Vector AC = C - A;
Vector AB = B - A;
float ab2 = AB.DotProduct(AB);
float acab = AC.DotProduct(AB);
float t = acab / ab2;
if (t < 0.0f)
t = 0.0f;
else if (t > 1.0f)
t = 1.0f;
P = A + t * AB;
Vector H = P - C;
float h2 = H.DotProduct(H);
float r2 = r * r;
if(h2 > r2)
return false;
else
return true;
}
Now I'm proficient in C#, so I can read that quite easily, but it should be fairly obvious even if you've never used C before what it generally means.
Here is the AS3 version of that code:
// C is the location of the circle
// r is the radius of the circle
// A is the first point defining the line
// B is the second point defining the line
// NOTE: Actionscript doesn't have the functionality for 'P' to
// work like it does in C, but it isn't essential.
public function CircleSegmentIntersect(C:Point, r:Number, A:Point, B:Point):Boolean
{
var AC:Point = new Point(C.x - A.x, C.y - A.y);
var AB :Point = new Point(B.x - A.x, B.y - A.y);
var ab2:Number = AB.x * AB.x + AB.y * AB.y;
var acab:Number = AB.x * AC.x + AB.y * AC.y;
var t:Number = acab / ab2;
if (t < 0)
t = 0;
else if (t > 1)
t = 1;
var P:Point = new Point(A.x + t * AB.x, A.y+ t * AB.y);
var H:Point = new Point(P.x - C.x,P.y - C.y);
var h2:Number = H.x * H.x + H.y * H.y;
var r2:Number = r * r;
if(h2 > r2)
return false;
else
return true;
}
That code is untested, I just converted it right here on the forums, but in theory it should work, so try it out!