I am having trouble resetting the _x value of a movieclip. I have 3 MCs that scroll along the bottom. When one of the three clips move to far to either the right or left side, I want to move it to the opposite side. Here is a sample of the code I am trying to use to do this:
function moveLeft(position, index) {
//check if index is negative nubmer
if (index <0) {
index = -index;
}
//get story # if index is over the total number of stories
if (index >= entryNode.length) {
index = index-entryNode.length*(Math.floor(index/entryNode.length));
}
//if the first TN is clicked, get url
if (position == 0){
getURL(links[index]);
}
//move TNs left
else {
for (h=0; h<3; h++) {
//move tnSets
trace(_root.tnContainer_mc["tnSet"+h]._x);
var current_mc = _root.tnContainer_mc["tnSet"+h];
var oldX = current_mc._x;
var newX = current_mc._x - ((tnWidth+tnSpacing)*position);
setEase(current_mc, oldX, newX);
//move tnSet to the right if too far left
if (_root.tnContainer_mc["tnSet"+h]._x <= -2*(tnSet._width + 10)){
trace('move right: '+ _root.tnContainer_mc["tnSet"+h]);
_root.tnContainer_mc["tnSet"+h]._x = (tnSet._width+10);
trace(_root.tnContainer_mc["tnSet"+h]._x)
}
}
loadStory(index);
}
}
I have zipped my .fla file and attached it.