Heres my new version which im still having problems with
function createEdge()
{
tool.text="EDGE";
nodeMode=false;
edgeMode=true;
createEdgeButt.gotoAndPlay("down");
createNodeButt.gotoAndStop("up");
_root.z+=1;
this._parent.createEmptyMovieClip("tempLine", _root.z);
_root.z+=1;
this._parent.createEmptyMovieClip("point1", _root.z).buildPoint(3);
_root.z+=1;
this._parent.createEmptyMovieClip("point2", _root.z).buildPoint(3);
point1._visible = false;
point2._visible = false;//same as point1._visible=false; point2._visible=false
delete this._parent._parent.onMouseDown;
this._parent._parent.onMouseDown = drawProcess;//25/3
this._parent._parent.onMouseUp = drawFinalLine;
this._parent._parent.onEnterFrame = clearMe;
}
function drawProcess() {
if(edgeMode==true)
{
if(canvas.hitTest(this._parent._xmouse, this._parent._ymouse, true)) {
_root.lineNum++;
_root.z+=1;
//create a seperate mc for each line
this._parent.createEmptyMovieClip("line"+_root.lineNum, _root.z);
xPos = _xmouse;
yPos = _ymouse;
trace("_xmouse: " + xPos + " _ymouse: " + yPos);
point1._x = point2._x=xPos
point1._y = point2._y=yPos
point1._visible = point2._visible=true;
this._parent["line"+ _root.lineNum].moveTo(xPos, yPos);
trace("x: " + this._parent["line" + 1]._x);
this.onMouseMove = function() {
tempLine.clear();
tempLine.lineStyle(2, 0xC9C9FC, 50);
tempLine.moveTo(xPos, yPos);
if (Key.isDown(Key.SHIFT)) {
if (_ymouse<=yPos-100 || _ymouse>=yPos+100) {
point2._x = xPos;
point2._y = _ymouse;
tempLine.lineTo(xPos, _ymouse);
} else {
point2._x = _xmouse;
point2._y = yPos;
tempLine.lineTo(_xmouse, yPos);
}
} else {
point2._x = _xmouse;
point2._y = _ymouse;
tempLine.lineTo(_xmouse, _ymouse);
}
};
}
}
}
function drawFinalLine() {
if(edgeMode==true)
{
if(canvas.hitTest(this._parent._xmouse, this._parent._ymouse, true)) {
tempLine.clear();
delete this.onMouseMove;
point1._visible = point2._visible=false;
this._parent["line" + _root.lineNum].lineStyle(.25, 0x2525F3, 100);
if (Key.isDown(Key.SHIFT)) {
if (_ymouse<=yPos-100 || _ymouse>=yPos+100) {
this._parent["line" + _root.lineNum].lineTo(xPos, _ymouse);
} else {
this._parent["line" + _root.lineNum].lineTo(_xmouse, yPos);
}
} else {
this._parent["line" + _root.lineNum].lineTo(_xmouse, _ymouse);
}
//_root.lineNum = _root.lineNum + 1;
_root.p1x[_root.lineNum] = point1._x;
_root.p1y[_root.lineNum] = point1._y;
_root.p2x[_root.lineNum] = point2._x;
_root.p2y[_root.lineNum] = point2._y;
}
}
}