Draw a moving line from (400,100) to (500, 150)

Hi hi,

I am newbie in AS3. This forum is great. With the replies of my previous post, I have learned how to draw vertical, horizontal or with 45 degrees moving line.

But what if I want to draw a line from (400,100) to (500, 150)… I think I need to use some sine, cos or tan formula to increment … right ?? :


var line:Sprite = new Sprite;
addChild(line);

with (line.graphics) {
clear();
moveTo(400, 100);
lineStyle(1, 0xff6600);
lineTo(500, 150);
}

var sp:Sprite = new Sprite;
addChild(sp);
var lineY:uint = 100;
var lineX:uint = 400;

function drawLine(e:Event):void {

with (sp.graphics) {
	clear();
	moveTo(400, 100);
	lineStyle(1, 0xff6600);
	lineTo(lineX++, lineY++);   // I know this is not correct !!!!
}
trace("lineX = ", lineX, " lineY = ", lineY);

if ((lineY>150) || (lineX>500)) {
	removeEventListener(Event.ENTER_FRAME,drawLine);
}

}

addEventListener(Event.ENTER_FRAME,drawLine);


Please show me how to achieve this.

Thanks

Florence