This is a frame script. It assumes the blue square and the green square are movieclips that have been assigned the names mc1 and mc2.

If you want the lines to issue from a particular corner, orient the movieclips so that the crosshairs correspond to that corner.

I prefer to have the lines issue from the center (so I keep the crosshair centered).

code:

_root.createEmptyMovieClip("line_mc", 1);

MovieClip.prototype.drawLine = function()
{
this.clear();
this.lineStyle(2,0xFF0000,100);
this.moveTo(mc1._x, mc1._y);
this.lineTo(mc2._x, mc2._y);
}

// insure movieclips are in front of line
mc1.swapDepths(2);
mc2.swapDepths(3);

// draw initial line
line_mc.drawLine();

mc1.onPress = mc2.onPress = function()
{
this.startDrag();
line_mc.onEnterFrame = drawLine;
}

mc1.onRelease = mc2.onRelease = function()
{
delete line_mc.onEnterFrame;
this.stopDrag();
}