# Why doesn't this code produce another moving mc?

**URL:** <https://forum.kirupa.com/t/why-doesnt-this-code-produce-another-moving-mc/200823>\
**Category:** flash\
**Created:** [September 15, 2006, 2:28pm UTC](https://forum.kirupa.com/t/why-doesnt-this-code-produce-another-moving-mc/200823 "2006-09-15T14:28:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lariat1997](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lariat1997](https://forum.kirupa.com/u/lariat1997)\
**Post date:** [September 15, 2006, 2:28pm UTC](https://forum.kirupa.com/t/why-doesnt-this-code-produce-another-moving-mc/200823/1 "2006-09-15T14:28:33Z")

</div>

Hey all,

I am trying to produce a scolling mc that is duplicated every 30 pixels. Each duplicate will scroll right behind the other along the x-axis.

My code will make the first mc scoll and it even produces a duplicate(s) at pixel 40, but the dups don’t move and I think there are even a lot of dups that are just laying on top of each other.

**BELOW IS THE CODE:  
[COLOR=Blue]  
[/COLOR]**[COLOR=Blue]var ball:MovieClip;  
var speed:Number=5;

ball.onEnterFrame = function():Void  
{  
this.\_x += speed;

```
    if(ball._x==300){
        ball._x=0;
}

```

//Start of duped mc  
if(ball.\_x==40)  
{  
duplicateMovieClip(ball, “ball”+i, getNextHighestDepth()+i);  
for(i=0; i\<20; i++)  
{

```
        ball*.onEnterFrame = function():Void 
            { ball*._x = 0;
                this._x += (speed + (i*20));
    
                if(ball*._x==300)
                {
                    ball*._x=0;
                }
            }    
            //removeMovieClip(ball*);//does this really work?
            
        }
    }
    trace(ball*._x);

```

};[/COLOR]

Anyone have any ideas on how to make this work correctly?

Thanks.
