Drawing multiple lines - only last line survives
================================================
Dear folks,
I'm doing a simple program where I have an MC which I can drag across screen. A line is then drawn from the last point (where I started to drag) to the new point (where I ended the drag). All works fine... so far. The problem is that when I start to drag the MC again to a new point, it does again create the right line but it deletes the old one !!.. Or at least it looks like it does.....
Now, I know it has to do with getNexHighestDepth() because when I change it into 100 for example it works fine.. However, for my real project i'm having this problem with (code below is just a simple sample I have setup beceause the orinal has 1000+ lines of code.. to much !) i MUST use getNexHighestDepth()..... But it doesn't work....
Here's the code (on the draggable MC):
on(press){
xnow = this._x;
ynow = this._y;
this.startDrag();
}
on(release){
this.stopDrag();
_root.createEmptyMovieClip ("triangle", getNextHeigestDepth());
with(_root.triangle){
lineStyle (4, 0xFF0000, 100);
moveTo (xnow, ynow);
lineTo (this._x, this._y);
}
}
P.s. This MC is in the _root.
Thnx a million !!!
================================================
Dear folks,
I'm doing a simple program where I have an MC which I can drag across screen. A line is then drawn from the last point (where I started to drag) to the new point (where I ended the drag). All works fine... so far. The problem is that when I start to drag the MC again to a new point, it does again create the right line but it deletes the old one !!.. Or at least it looks like it does.....
Now, I know it has to do with getNexHighestDepth() because when I change it into 100 for example it works fine.. However, for my real project i'm having this problem with (code below is just a simple sample I have setup beceause the orinal has 1000+ lines of code.. to much !) i MUST use getNexHighestDepth()..... But it doesn't work....
Here's the code (on the draggable MC):
on(press){
xnow = this._x;
ynow = this._y;
this.startDrag();
}
on(release){
this.stopDrag();
_root.createEmptyMovieClip ("triangle", getNextHeigestDepth());
with(_root.triangle){
lineStyle (4, 0xFF0000, 100);
moveTo (xnow, ynow);
lineTo (this._x, this._y);
}
}
P.s. This MC is in the _root.
Thnx a million !!!