XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<travel>
<trip city="">
</trip>
<trip city="jugando">
<url>www.ejemplos.com.tk</url>
</trip>
<trip city="potrero de rose">
<url>www.jauriakn.net</url>
</trip>
<trip city="isumi azuka">
<url>www.sumorika.org</url>
</trip>
</travel>
Codigo:
var xmlLoader:URLLoader = new URLLoader();
var tripsURL:URLRequest = new URLRequest("trips.xml");
xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
xmlLoader.load(tripsURL);
var tripsXML:XML = new XML();
tripsXML.ignoreWhitespace = true;
function xmlLoaded(eva:Event):void{
tripsXML = XML(xmlLoader.data);
for(var tripNombre:String in tripsXML.trip){
trace(tripsXML.trip[tripNombre].@city);
cbTrips.addItem({label:tripsXML.trip[tripNombre].@city});
}
}
//desde aqui no se que hacer para llamar como link a url que tengo guardado en xml
function elegirCity(eva:Event):void{
trace("selected" + eva.target.selectedIndex);
juto.text = tripsXML.trip[eva.target.selectedIndex].title;
URLmostrar.htmlText = tripsXML.trip[eva.target.selectedIndex].url;
}
cbTrips.addEventListener(Event.CHANGE,elegirCity);