Hello guys,
I have a combobox:
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:
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”.