# Delete text on button press

**URL:** <https://forum.kirupa.com/t/delete-text-on-button-press/285391>\
**Category:** Uncategorized\
**Created:** [March 31, 2009, 9:18am UTC](https://forum.kirupa.com/t/delete-text-on-button-press/285391 "2009-03-31T09:18:56Z")\
**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:** [March 31, 2009, 9:18am UTC](https://forum.kirupa.com/t/delete-text-on-button-press/285391/1 "2009-03-31T09:18:56Z")

</div>

I have a button, a text field and 3 columns of text. I write a number(the number represents the number of lines that the columns have) on the text field and when I press the button I have to rearrange the lines of the columns. Something like this: I write 2 I press and the columns will be redisplayed without the line 2. The code is like this:  
var bigArray:Array = new Array();  
var itemArray:Array = new Array(“item1”, “item2”, “item3”);  
var priceArray:Array = new Array(“p1”, “p2”, “p3”);  
var quantityArray:Array = new Array(“q1”, “q2”, “q3”);  
bigArray[0] = itemArray;  
bigArray[1] = priceArray;  
bigArray[2] = quantityArray;

function deleteFromArray(arrObj:Array, arrItem:Number):Array {  
var arrOut:Array = arrObj;  
for ( var i:Number = 0; i \< arrObj.length; i++ ) {  
arrOut\*.splice(arrItem-1, 1);  
}  
return arrOut;  
};

function showBigArray(nr):Void {  
for (var j = 0; j \< nr; j++) {  
var \_itemText:TextField = \_root.createTextField("\_item"+j, \_root.getNextHighestDepth(), 0, 0, 50, 25);  
var \_priceText:TextField = \_root.createTextField("\_price"+j, \_root.getNextHighestDepth(), 0, 0, 50, 25);  
var \_quantityText:TextField = \_root.createTextField("\_quantity"+j, \_root.getNextHighestDepth(), 0, 0, 50, 25);  
\_itemText.text += itemArray[j] + "  
";  
\_itemText.\_x = 50;  
\_itemText.\_y = j\*(\_itemText.\_height + 5) + 10;

```
    _priceText.text += priceArray[j] + "

```

";  
\_priceText.\_x = \_itemText.\_x + \_itemText.\_width;  
\_priceText.\_y = j\*(\_priceText.\_height + 5) + 10;

```
    _quantityText.text += quantityArray[j] + "

```

";  
\_quantityText.\_x = \_priceText.\_x + \_priceText.\_width;  
\_quantityText.\_y = j\*(\_quantityText.\_height + 5) + 10;  
}  
}

var string:String;  
btn.onRelease = function() {  
string = inputTxt.text;  
trace(deleteFromArray(bigArray, int(string)));  
showBigArray(itemArray.length);  
}

showBigArray(itemArray.length);

Thank you.
