# Using data from combobox as a property of object

**URL:** <https://forum.kirupa.com/t/using-data-from-combobox-as-a-property-of-object/183733>\
**Category:** flash\
**Created:** [March 29, 2006, 4:22pm UTC](https://forum.kirupa.com/t/using-data-from-combobox-as-a-property-of-object/183733 "2006-03-29T16:22:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poco](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@Poco](https://forum.kirupa.com/u/Poco)\
**Post date:** [March 29, 2006, 4:22pm UTC](https://forum.kirupa.com/t/using-data-from-combobox-as-a-property-of-object/183733/1 "2006-03-29T16:22:51Z")

</div>

Hello guys,

I have a combobox:

```auto

search_cb.addItem({data:date, label:"Date"});
search_cb.addItem({data:name, label:"Name"});
search_cb.addItem({data:measures, label:"Measures"});

var searchcbListener:Object = new Object();
searchcbListener.change = function(evt_obj:Object) {
    var item_obj:Object = search_cb.selectedItem;
    var i:String;
    for (i in item_obj) {
        _root.searchin = item_obj*.data; //this is not good
    }
}
search_cb.addEventListener("change", searchcbListener);

```

Now I have some objects like (all attributes are strings):  
myObj1.date = …  
myObj1.name =…  
my Obj1.measures =…  
myObj2.date = … and so on.  
Now I have a function, which I would like to use for searching in the properties of objects. The user should type the request into input field, choose the property from dropdown and press “go”. Just that I can’t pass the data from dropdown to the search function. Any ideas?  
This is the search function:

```auto

function search(string:String, where):Void{
    for (var i=0; i<objectArray.length; i++){
    trace("in for"+i);
    if (objectArray*.measures.indexOf(string) > -1)
        trace(objectArray*.measures+" - "+objectArray*.name);
    }
}

```

just that now the property set is “measures”, I need to change this dynamically (name, measures, date).  
Thanks for advices!

Poco

PS: \_root.searchin should be the variable in root holding “where to search”.
