Drawing from one MC to the Next

hey there, I want to plonk some mcs on stage, and then in their order of placement, I want to attach a line from one to the next … I keep getting horrible errors from my code.
If someone could help me out, id be grateful!

var mcArray:Array = new Array();

for (var i:int = 0; i<3; i++)
{
    var mc:square = new square();
    mc.x = Math.random()*500;
    mc.y = Math.random()*200;
    mc.name = "square"+i;
    mc.id = i;
    mcArray.push(mc);
    
    mc.addEventListener(Event.ENTER_FRAME, connect);
    addChild(mc);
}
function connect(e:Event):void
{
    var me:Number = e.target.id;
    var next:Number = me + 1;
    trace(me);
    trace(next);
    trace(mcArray[me].x)
    trace(mcArray[next].x)
    /*
    e.target.graphics.lineStyle(1,0x000FFF);
    e.target.graphics.moveTo(e.target.x,e.target.y);
    e.target.graphics.lineTo(mcArray[next].x,mcArray[next].y);*/
e.target.removeEventListener(Event.ENTER_FRAME, connect);
}

The error is ::
** A term is undefined and has no properties.**

The reason im having ENTER_FRAME, is that I eventually want to animate these blocks … keeping the lines attached. I have a couple of other reasons why i need them in an array too… Thanks!:rock: