Hello all. I have a pretty simple script that allows you to draw multiple rectangles using the drawing API in MX. I need to create multiple MC containers, so that I can later do other functions to these areas.
Now, what I can’t figure for the life of me is why the rectangles are drawing in the way they are. If you copy this script into a blank file and run it, you’ll see what I mean. Why is it duplicating/replicating/echoing as you draw? If you debug and list Objects, it is creating the MCs properly, so where are these other lines coming from? I’m sure this is something simple to fix, that there is some recursion going on, but I can’t troubleshoot it.
Helps me please…
drawLevel = 0;
drawOK = "yes";
this.onMouseDown = function() {
//
if (_root.drawOK == "yes") {
this.createEmptyMovieClip("rect"+drawLevel, drawLevel);
sx = _xmouse;
sy = _ymouse;
drawing = true;
drawLevel += 1;
}
};
this.onMouseMove = function() {
//
if (_root.drawOK == "yes") {
if (drawing) {
cx = _xmouse;
cy = _ymouse;
beginFill(0xFFCC00, 10);
lineStyle(1, 0xFFCC00, 100);
moveTo(sx, sy);
lineTo(sx, cy);
lineTo(cx, cy);
lineTo(cx, sy);
lineTo(sx, sy);
endFill();
}
}
};
this.onMouseUp = function() {
//
drawing = false;
};
stop();