Newbie about animating a line in actionscript

hey! newbie here :h: hmm…i´m trying to start to learn actionscript. so, my idea is to just draw an animated square within i will load an image. but first off i´m trying to draw a straight line from one point to another. my probs is that i would like to control the speed the line will be drawn, first i want it to draw the x-axis quite fast, make a pause and then draw the y-axis and paus. i´m trying to use setInterval(function, speed), but it doesn´t quite work thou :upset: here´s my code:

_root.createEmptyMovieClip(“mc_clip”, 0);

function drawLine() {
//variablar
x = 0;
y = 20;

mc_clip.onEnterFrame = function() {
	mc_clip.createEmptyMovieClip("newLine", 1);
	with(newLine) {
		lineStyle(1, 0x000000, 100);
		moveTo(200, 20);
		lineTo(x++, y);
	};
};

};
this.drawLine();
setInterval(drawLine, 1000);

sorry, thanks for answers :s:

Not exactly what you want but may get you going in the right direction

myArray = [[100, 200], [200, 200], [200, 100], [100, 100], [100, 200]];
this.createEmptyMovieClip(“paper”, 1);
paper.lineStyle(1, 0x000000, 100);
i = 0;
paper.moveTo(myArray*[0], myArray*[1]);
function draw() {
j = i+1;
if (j<myArray.length) {
incX1 = (myArray[j][0]-myArray*[0])/10;
incY1 = (myArray[j][1]-myArray*[1])/100;
} else {
incX1 = 0;
incY1 = 0;
}
incX += incX1;
incY += incY1;
paper.lineTo(myArray*[0]+incX, myArray*[1]+incY);
if (i<myArray.length-1) {
if (myArray*[0]+incX == myArray[j][0] && myArray*[1]+incY == myArray[j][1]) {
trace(“done”);
clearInterval(myInterval);
i += 1;
incX = 0;
incY = 0;
myInterval = setInterval(draw, 20);
}
} else {
clearInterval(myInterval);
}
}
myInterval = setInterval(draw, 20);