# Scrolling movie clip as2 what am I doing wrong?

**URL:** <https://forum.kirupa.com/t/scrolling-movie-clip-as2-what-am-i-doing-wrong/286986>\
**Category:** Uncategorized\
**Created:** [April 24, 2009, 1:17am UTC](https://forum.kirupa.com/t/scrolling-movie-clip-as2-what-am-i-doing-wrong/286986 "2009-04-24T01:17:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![juskin](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@juskin](https://forum.kirupa.com/u/juskin)\
**Post date:** [April 24, 2009, 1:17am UTC](https://forum.kirupa.com/t/scrolling-movie-clip-as2-what-am-i-doing-wrong/286986/1 "2009-04-24T01:17:48Z")

</div>

so I am trying to program a scrolling movie clip that basically moves across the screen, and gets duplicated, and added to the end to create an infinite loop.

The logic Im using is an enterframe function that does two things:  
1 incrementally moves the clip across the stage  
2 checks the clips \_x position, once it passes that position, it fires a function duplicating the clip, positioning its x and y, and then that calls another function to move it along the screen.

Im really trying to understand the logic, so if my logic is off, please advise me in the right direction… and here is the code…

thumbsClip.onEnterFrame = function() {  
this.\_x ++;  
if(thumbsClip.\_x == -150) {  
addClip();  
}  
}

```
function addClip() {
//attachMovie("ThumbsClip", "instance2", this.getNextHighestDepth(), {_x:-744, _y:-33});
duplicateMovieClip("ThumbsClip", "ThumbsClipB", this.getNextHighestDepth());
ThumbsClipB._x = -100;
ThumbsClipB._y = -33;
//trace("duplicated");
trace(ThumbsClipB._x)
runDup();

```

}

```
function runDup() {
ThumbsClipB._x ++;
trace("clipB moving");

```

}
