I'm trying to create a search function in the site I'm currently building.
It is flash based and all the data is pulled dynamically from XML files.
I've managed to get as far as searching for items, but the whole item name must be used.
What I'm struggling with is how can I search for partial words.
This is the code that does the searching after the XML is loaded.
Code: Select all
//Word entered to search for
var filterValue:String = nameTile.toLowerCase();
//Matching the word against items in the XML
var filteritems:String = xmldata.product.(tile == filterValue);
//Returns if item is found or not
var index:int = filteritems.indexOf(filterValue);
if (index != -1) {
trace(filteritems);
} else {
trace("Item not found");
}