I have a function that sends a search term, xmllist & content to be
searched with indexes at end of each line to represent item in
xmllist. The function then outputs and xmllist of the found nodes
that have the search term in them however if the the text in the node
has two words or more words that are the same it will add that node
however many times that word appears. How can I prevent this?
function searchStringInAttribute(list:XMLList, attributelist:String,
term:String):XMLList {
var output:XMLList = new XMLList();
//trace("ALIST {" + attributelist + " } ALIST End " + "\n");
var i:Number = 0;
var pos:Number = 0;
var index:int = 0;
var count:int = 0;
while (i > -1) {
pos = attributelist.indexOf(term, i);
if (pos > -1) {
index = int( attributelist.substring(attributelist.indexOf("<",
pos)+1, attributelist.indexOf(">", pos)) );
output[count] = list[index];
count++;
i = pos+term.length;
} else {
i = pos;
}
}
return output;
}
adam randlett
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders