# Drawing from one MC to the Next

**URL:** https://forum.kirupa.com/t/drawing-from-one-mc-to-the-next/295228
**Category:** flash
**Created:** [August 26, 2009, 11:19pm UTC](https://forum.kirupa.com/t/drawing-from-one-mc-to-the-next/295228 "2009-08-26T23:19:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)
#### Post date: [August 26, 2009, 11:19pm UTC](https://forum.kirupa.com/t/drawing-from-one-mc-to-the-next/295228/1 "2009-08-26T23:19:29Z")

</div>

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!

```auto
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:
