Hello !
Is there someone who is good at trigonometry?
I have two points punkt1 and punkt2 and a line that is drawn between them. Both points is dragable. I want the line to continue after the points in both directions and with the same steep. I have counted the steep between point1 and point2 and tried to continue to drag to a point with the same steep, but it doesn´t succed.
onLoad = function(){
_root.punkt2._x=100;
_root.punkt2._y=100;
_root.punkt1._x=200;
_root.punkt1._y=200;
}
//-----------------------onEnterFrame------------------------
onEnterFrame = function() {
function doDrag() {
this.startDrag();
}
function noDrag() {
stopDrag();
}
_root.punkt2.onPress = doDrag;
_root.punkt2.onRelease = noDrag;
_root.punkt1.onPress = doDrag;
_root.punkt1.onRelease = noDrag;
a1=punkt2._y-punkt1._y
a2=punkt2._x-punkt1._x
k=a1/a2
p3x=punkt2._x/k+punkt2._x
p3y=punkt2._y/k-100
createEmptyMovieClip('hold', 10);
with (hold) {
clear();
lineStyle(2);
moveTo(punkt1._x, punkt1._y);
lineTo(punkt2._x, punkt2._y);
lineTo(p3x, p3y);
}
}