这是您为两个圆圈描述的工作代码 - 假设两个圆圈大小相同。否则它是一个近似值,因为它假设切点将在垂直于连接圆心的直线上。
var point1 : Point = new Point(100, 100);
var point2 : Point = new Point(300, 50);
var radius1 : int = 60;
var radius2 : int = 30;
// if you draw a line from the first circle origo to
// the second origo, this is the angle of that line
var ang : Number = Math.atan2(point2.y - point1.y, point2.x - point1.x);
// find the first point on the circumference that is orthogonal
// to the line intersecting the two circle origos
var start1 : Point = new Point(point1.x + Math.cos(ang + Math.PI / 2) * radius1,
point1.y + Math.sin(ang + Math.PI/2)* radius1);
var end1 : Point = new Point(point2.x + Math.cos(ang + Math.PI / 2) * radius2,
point2.y + Math.sin(ang + Math.PI/2)* radius2);
// find the second point on the circumference that is orthogonal
// to the line intersecting the two circle origos
var start2 : Point = new Point(point1.x + Math.cos(ang - Math.PI / 2) * radius1,
point1.y + Math.sin(ang - Math.PI/2)* radius1);
var end2 : Point = new Point(point2.x + Math.cos(ang - Math.PI / 2) * radius2,
point2.y + Math.sin(ang - Math.PI/2)* radius2);
// draw everything on the stage
this.graphics.lineStyle(1, 0x0);
this.graphics.drawCircle(point1.x, point1.y, radius1);
this.graphics.drawCircle(point2.x, point2.y, radius2);
this.graphics.moveTo(start1.x, start1.y);
this.graphics.lineTo(end1.x, end1.y);
this.graphics.moveTo(start2.x, start2.y);
this.graphics.lineTo(end2.x, end2.y);