# Weird problem with LineTo

**URL:** <https://forum.kirupa.com/t/weird-problem-with-lineto/271375>\
**Category:** flash\
**Created:** [September 22, 2008, 1:08pm UTC](https://forum.kirupa.com/t/weird-problem-with-lineto/271375 "2008-09-22T13:08:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![odiecreversed](https://avatars.discourse-cdn.com/v4/letter/o/43a26b/32.png) [@odiecreversed](https://forum.kirupa.com/u/odiecreversed)\
**Post date:** [September 22, 2008, 1:08pm UTC](https://forum.kirupa.com/t/weird-problem-with-lineto/271375/1 "2008-09-22T13:08:01Z")

</div>

I have a problem with referring to something…

I create a an array, a timer and movieclip variable… then…

```auto
containerMC.graphics.lineStyle (0.1, 0x000000);

for(var s=0 ;s<2;s++){
    addChild(containerMC)
    dotArray.push(containerMC)
}

function timedFunction(eventArgs:TimerEvent):void {
    for(var s=0 ;s<dotArray.length;s++){
        dotArray[s].graphics.lineTo (Math.random()*400,Math.random()*400);
    }
}

```

For some reason it refers to the same movieclip again and again even though it should be refering to a different one (I’ve traced ‘s’ and it is definitely increasing). What I get is two new sections of one line being drawn every timer event. I want one line being added to each two separate lines.

I really have no idea here… I’ve tried making two arrays, putting one movieclip inside another to seperate everything a little more, but the same thing keeps happening.

Any help would be wonderful
