var movebeans = true;
var moveBeansArray = new Array(bean_1, bean_2, bean_3);
var xPosArray = new Array(200, 250, 300);
onEnterFrame = function () {
if (movebeans == true) {
moveBeansArray[0]._x += (xPosArray[0]-moveBeansArray[0]._x)/10;
}
};
if (movebeans == true) {
moveBeansArray[0]._x += (xPosArray[0]-moveBeansArray[0]._x)/10;
trace(moveBeansArray[0]._name);
}
If it comes out undefined, make sure you don't have spelling inconsistencies between the clip names and what is in the array. Also, make sure that the array you created and the array that you are referencing are the same array.
You could also try this:
if (movebeans == true) {
moveBeansArray[0]._x += 5;
}
To make sure that it is the moveBeansArray that has the problem, and not the xPosArray.
Thanks for reply,
Have checked that....
Here is a fla. with the actual working code showing what i am trying to do - it works when i ref the actual clip name (bean_1)
Then i've repeated the same code underneath but used the moveBeansArray[0] instead of bean_1 and then it doesn't work! i need it to work using the array?