:p:
Ive a program with a set of points which change in number.
Sometimes the number of points is 1 or 0 or 42 or 12.
The points are contained in an array.
I am trying to have a traceDraw-esque function where when I click a checkbox, a set of lines appear between all the points and a set of numbers appear on the lines midpoints displaying the distance between the points.
My current implementation is crap. See here:

var ptA = new Point(ballArray[0].x, ballArray[0].y);
ptA = gameStage.localToGlobal(ptA);
_line.graphics.lineStyle(1, 0x8888ff);
_line.graphics.moveTo(ptA.x, ptA.y);
for (i = 0; i < ballArray.length; i++)
{
for (j = 0; j < ballArray.length; j++)
{
labelArray*.alpha = 1;
labelArray*.move((ballArray*.x + ballArray[j].x) / 2, (ballArray*.y + ballArray[j].y) / 2);
labelArray*.text = ballArray*.h.toFixed(1);
ptA.x = ballArray[j].x;
ptA.y = ballArray[j].y;
ptA = gameStage.localToGlobal(ptA);
if (i != j)
{
_line.graphics.lineTo(ptA.x, ptA.y);
}
}
}
Now how would I do this so each point links to each other point exactly once, and it works when there are only 2 points also?