Hi All,
I have this code where I include Tweens in an array, and once the last Tween has run, I try to clean up the Array, but I get an error message: TypeError: Error #1010: A term is undefined and has no properties. Could you please take a look and let me know what’s wrong? Thanks
var coordCounter:int = 0;
var array:Array = new Array();
var tween1:Tween;
var tween2:Tween;
var tween3:Tween;
var j:int;
for (j=0; j<bgItems.length; j++) {
tween1 = new Tween(bgItems[j],"x",Strong.easeOut,bgItems[j].x,bgItemsXCoord[j][coordCounter],3,true);
tween2 = new Tween(bgItems[j],"y",Strong.easeOut,bgItems[j].y,bgItemsYCoord[j][coordCounter],3,true);
tween3 = new Tween(bgItems[j],"rotation",Strong.easeOut,bgItems[j].rotation,bgItemsRCoord[j][coordCounter],3,true);
array.push (tween1);
array.push (tween2);
array.push (tween3);
array[array.length - 1].addEventListener (TweenEvent.MOTION_FINISH, bgAnimationComplete, false, 0, true);
}
function bgAnimationComplete (e:TweenEvent):void {
array[array.length - 1].removeEventListener (TweenEvent.MOTION_FINISH, bgAnimationComplete);
array=[];
nextFrame ();
}