# What is wrong with my script

**URL:** <https://forum.kirupa.com/t/what-is-wrong-with-my-script/287828>\
**Category:** flash\
**Created:** [May 6, 2009, 7:43pm UTC](https://forum.kirupa.com/t/what-is-wrong-with-my-script/287828 "2009-05-06T19:43:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel\_mihalcea](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@daniel\_mihalcea](https://forum.kirupa.com/u/daniel_mihalcea)\
**Post date:** [May 6, 2009, 7:43pm UTC](https://forum.kirupa.com/t/what-is-wrong-with-my-script/287828/1 "2009-05-06T19:43:53Z")

</div>

Hello there. I have some functions that are creating a table with items and I have the possibility to delete that elements.  
My table appear if I press a button. And my elements are represented by arrays.  
My problem is that if I press the button twice, it is multiplying my elements from the table. It is something like this:  
I press, it opens:  
item 1  
item 2  
item 3  
I press again:  
item 1  
item 2  
item 3  
item 1  
item 2  
item 3  
My script that opens the table is this:  
var \_itemArray:Array = new Array(“item\_1”, “item\_2”, “item\_3”);  
var \_priceArray = [10, 20, 30];  
var \_quantityArray = [2, 3, 4];

view\_mc.onRelease = function() {  
if (\_itemArray.length \> 0) {  
shopList\_mc.\_x = 35;

for (var i = 0; i\<\_itemArray.length; i++) {  
shopList\_mc.addItem(\_itemArray\*,\_priceArray\*,\_quantityArray\*);  
}  
shopList\_mc.renderList();  
} else {  
return 0;  
}  
}

Thank you.  
 ![](http://1.1.1.5/bmi/www.actionscript.org/forums/images/statusicon/user_offline.gif)[![](http://1.1.1.3/bmi/www.actionscript.org/forums/images/buttons/quote.gif)](http://www.actionscript.org/forums/newreply.php3?do=newreply&p=880323)
