# comboBox addItem (data:variable)

**URL:** <https://forum.kirupa.com/t/combobox-additem-data-variable/282670>\
**Category:** flash\
**Created:** [February 25, 2009, 12:48am UTC](https://forum.kirupa.com/t/combobox-additem-data-variable/282670 "2009-02-25T00:48:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldgreymare](https://avatars.discourse-cdn.com/v4/letter/o/838e76/32.png) [@oldgreymare](https://forum.kirupa.com/u/oldgreymare)\
**Post date:** [February 25, 2009, 12:48am UTC](https://forum.kirupa.com/t/combobox-additem-data-variable/282670/1 "2009-02-25T00:48:52Z")

</div>

Hi there

I’ve got a combo box adding items from an array. The labels are working just fine, but adding the data with a variable won’t work for me. If I put in an actual number, I get that result, but trying to add it with a variable I always get 1 as a result. classData only ever = 1. I can access the array. I know it must be in the syntax. I’ve tried

```auto
yourClasses_cb.addItem({data:String(classData),label:classLabel});

```

```auto
yourClasses_cb.addItem({data:Number(classData),label:classLabel});

```

```auto
yourClasses_cb.addItem({data:[classData],label:classLabel});

```

I don’t know why it works for classLabel and not for classData. The whole section of code is here:

```auto
for (j=0; j<ComboNames.length; j++) {
			classLabel = ComboNames[j];
			classData = classIDs[j];
			yourClasses_cb.addItem({data:classData,label:classLabel});
			trace("Your class list (there should be "+classIDs.length+" items)"+classIDs+" Calling just the 10th item in the array: "+classIDs[10]+" calling for the variable classData "+classData);
		}

```

Please let me know if I’ve got something obviously wrong here…  
Thanks a bunch
