Array Help (Random Values stated and Called)

I am trying to make a random shape, I want each different point to draw a line to every other point, which I know this won’t do yet even if it worked the way that I wanted. But, at the moment, my code does nothing. It is supposed to draw a line from from the first value in the point array to the second value in it to the third value in it. I can’t figure out what I’m doing wrong, am I declaring it wrong? Calling it wrong? Doing it wrong all together?

Here’s my code:

onLoad = function() {
	drawIt(10);
}

function drawIt(numberOfPoints) {
	randomPoints(numberOfPoints);
	createEmptyMovieClip(shape, 0);
	shape.lineStyle(3, 000000, 100);
	shape.moveTo(point[x1], point[y1]);
	for(i=0; i<numberOfPoints; i++) {
		shape.lineTo(point["x"+i], point["y"+i]);
	}
}

function randomPoints(numOfPoints) {
	point = new Array();
	drawToNumOfPoints = numOfPoints;
	for (i=0; i<numOfPoints; i++) {
		generateRandoms();
		point["x"+i] = randomX;
		point["y"+i] = randomY;
	}
}

function generateRandoms() {
	randomX = random(stage.width);
	randomY = random(stage.height);
}

I have also tried switching the line

point = new Array();

to

point = new Object();

but to no avail.

Thanks for your help. :slight_smile: