# Array and text

**URL:** <https://forum.kirupa.com/t/array-and-text/284941>\
**Category:** Uncategorized\
**Created:** [March 25, 2009, 11:35am UTC](https://forum.kirupa.com/t/array-and-text/284941 "2009-03-25T11:35:33Z")\
**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 25, 2009, 11:35am UTC](https://forum.kirupa.com/t/array-and-text/284941/1 "2009-03-25T11:35:33Z")

</div>

Hello. I have this function:  
function addItem(bkItem):Void {  
\_aProducts.push(bkItem);  
dispatchEvent({type: “update”, target: this});  
var list:MovieClip = createEmptyMovieClip(“list\_mc”, 25);  
var listText:TextField = list.createTextField(“list\_txt”, 26, 0, 0, 150, 350);  
var numar:TextField = list.createTextField(“numar\_txt”, 30, 30, 40, 50, 50);  
numar.type = “input”;  
listText.selectable = false;  
list.\_x = 680;  
list.\_y = 440;  
var i;  
var cont = 0;  
for (i = 0; i \< \_aProducts.length; i++) {  
listText.text += \_aProducts\* + "  
";  
if (\_aProducts\* == listText.text) {  
cont++;  
trace(cont);  
}

```
}
numar.text = i;

```

}

I press a button and display what I press. If I press more then once on a product I what to initialize a cont and to display the product+the number of presses else to display the list.  
My problem is that if doesn’t do this part:  
if (\_aProducts\* == listText.text) ??  
Thank you.
