# Array clean up Error

**URL:** <https://forum.kirupa.com/t/array-clean-up-error/297002>\
**Category:** flash\
**Created:** [September 24, 2009, 12:50am UTC](https://forum.kirupa.com/t/array-clean-up-error/297002 "2009-09-24T00:50:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CayoHueso](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@CayoHueso](https://forum.kirupa.com/u/CayoHueso)\
**Post date:** [September 24, 2009, 12:50am UTC](https://forum.kirupa.com/t/array-clean-up-error/297002/1 "2009-09-24T00:50:15Z")

</div>

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

```auto

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 ();

}

```
