# Target headache

**URL:** https://forum.kirupa.com/t/target-headache/299410
**Category:** Uncategorized
**Created:** [November 4, 2009, 6:00pm UTC](https://forum.kirupa.com/t/target-headache/299410 "2009-11-04T18:00:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![centigrade](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@centigrade](https://forum.kirupa.com/u/centigrade)
#### Post date: [November 4, 2009, 6:00pm UTC](https://forum.kirupa.com/t/target-headache/299410/1 "2009-11-04T18:00:56Z")

</div>

Hi this is my code. I’m using tweener for some animations but for some reason I can’t get it to work with movie clip duplicates. The duplicate is called mainWave0 and I can do things like get the \_x value but I can’t get the tweener code to work on it in the enterframe function. However the tweener code in doWaveAniA manipulates the clip correctly. Basically all I want to do is loop it from right to left.

Thanks and heres the piece of relevant code.

var total = 1;  
for (i=0; i\<total; i++) {  
duplicateMovieClip(mainWaveA, “mainWave”+i, i);  
\_root[“mainWave”+i].\_y = 325+5\*i;  
}

// Basically a listener for the waves position change…this works for mainWaveA but not mainWave0  
mainWaveA.onEnterFrame = function() {  
if (this.\_x != this.oldx && this.\_x == -988) {  
Tweener.addTween(mainWaveA,{\_x:0, time:0, delay:0, transition:“linear”});  
Tweener.addTween(mainWave0,{\_x:0, time:0, delay:0, transition:“linear”});  
}  
// adjust the time below for a natural lookingwave  
if (this.\_x != this.oldx && this.\_x == 0) {  
Tweener.addTween(mainWaveA,{\_x:-988, time:1, delay:0, transition:“linear”});  
Tweener.addTween(mainWave0,{\_x:-988, time:0, delay:0, transition:“linear”});  
}  
this.oldx = this.\_x;  
};

doWaveAniA();  
function doWaveAniA() {  
findRandNum();  
Tweener.addTween(mainWaveA,{\_yscale:myRandNum, time:myspeed, delay:0, transition:transitionType});  
Tweener.addTween(mainWave0,{\_yscale:myRandNum, time:myspeed, delay:0, transition:transitionType});  
}  
setInterval(doWaveAniA,1000);
