(en el xml la extension para que muestre las fotos pero no se que codigo poner en flash)
bueno pongo el codigo y espero algun alma caritativa
////////////////////////////////////////////////////////////////////////////////////////////
import com.xfactorstudio.xml.xpath.*;
myDoc = new XML();
myDoc.load("data/guide.xml");
String.prototype.searchReplace = function(find, replace) {
return this.split(find).join(replace);
};
function startSearch() {
this.taGuestStar.text = "";
this.txDescription.text = "";
this.txTitle.text = "";
this.txDate.text = "";
term = this.taSearchWords.text;
if (term == "") {
this.errorBox.gotoAndStop(2);
}
else {
tag = searchGroup.selection.data;
var query:String = "//ep[contains("+tag+", "+"'"+term+"'"+")]";
myResults = XPath.selectNodes(myDoc, query);
myDataSet = new Array();
for (var i = 0; i<myResults.length; i++) {
var name = XPath.selectNodes(myResults[i], "./name")[0].firstChild.nodeValue;
var id = XPath.selectNodes(myResults[i], "./id")[0].firstChild.nodeValue;
myDataSet.push({Name:name, ID:id});
}
this.dgSearchResults.dataProvider = myDataSet;
var hits = myResults.length;
if (hits == 1) {
hits = "1 Encontrados";
} else if (hits>1) {
hits = hits+" Encontrados";
} else {
hits = "No hubo coincidencias";
}
this.ResultsLabel.text = hits;
}
}
function highlightTerms() {
}
var gridindex = this.dgSearchResults.getSelectedItem().ID;
var sindex = gridindex.charAt(0);
var epindex1 = gridindex.charAt(2);
var epindex2 = gridindex.charAt(3);
if (epindex1 == 0) {
epindex = epindex2;
} else {
epindex = epindex1+epindex2;
var indexQuery:String = "/episodeguide/season["+sindex+"]/ep["+epindex+"]";
var choosenEpisodeData = XPath.selectNodes(myDoc, indexQuery);
var term = this.taSearchWords.text;
var choosenEpisodeDescription = XPath.selectNodes(choosenEpisodeData, "./d")[0].firstChild.nodeValue;
choosenEpisodeDescription = choosenEpisodeDescription.toString();
var newString1 = choosenEpisodeDescription.searchReplace(term, "<font color='#0000CC'><b>"+term+"</b></font>");
txDescription.text = newString1;
var choosenGuestStarText = XPath.selectNodes(choosenEpisodeData, "./gs")[0].firstChild.nodeValue;
choosenGuestStarText = choosenGuestStarText.toString();
var newString2 = choosenGuestStarText.searchReplace(term, "<font color='#0000CC'><b>"+term+"</b></font>");
taGuestStar.text = newString2;
txTitle.text = this.dgSearchResults.getSelectedItem().Name;
var choosenDatetext = XPath.selectNodes(choosenEpisodeData, "./dt")[0].firstChild.nodeValue;
choosenDatetext1 = choosenDatetext.toString();
txDate.text = choosenDatetext1;
}
function keyDownFunction() {
if (Key.isDown(Key.ENTER)) {
startSearch();
}
}
var EnterKeyListener = new Object();
EnterKeyListener.onKeyDown = keyDownFunction;
Key.addListener(EnterKeyListener);
stop();
txDescription.setStyle("marginLeft", "4");
txDescription.setStyle("marginRight", "1");
taGuestStar.setStyle("fontSize", "10");
//////////////////EN EL DATA GRID////////////////////////
on( load ) {
newColumn = new mx.controls.gridclasses.DataGridColumn("Name");
newColumn.headerText = "Name";
newColumn.editable = false;
newColumn.resizable = true;
newColumn.sortable = true;
newColumn.sortOnHeaderRelease = true;
newColumn.width = 320;
this.addColumn(newColumn);
}
on (change){
this._parent.highlightTerms();
}
