问题
Can't figure it out. Basically I have this code fetching data from: http://www.cbbh.ba/kursna_bs.xml
I can't move the data to a single line and <br />
is showing. My code is:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("http://www.cbbh.ba/kursna_bs.xml"));
/* This loads the XML */
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
parseData(xmlData);
}
/* This gets the data for today's tip */
function parseData(mTip:XML):void {
var itemXMLList:XMLList = XMLList(mTip..item);
var count:int = itemXMLList.length();
var finalcount:int = count - 1;
//trace(finalcount);
flashTip.htmlText = XMLList(mTip..item);
}
回答1:
This might help you:
flashTip.htmlText = XMLList(mTip..item).toString().replace(/<br \/>\s*/g,"\t");
Output:
Šifra valute: 978
EMU (EUR)
Jedinica: 1 Kupovni za devize: 1.95583 Srednji za devize: 1.95583 Prodajni za devize: 1.95583Šifra valute: 36
Australija (AUD)
Jedinica: 1 Kupovni za devize: 1.286221 Srednji za devize: 1.289445 Prodajni za devize: 1.292669
来源:https://stackoverflow.com/questions/22244340/xml-data-to-dynamic-text-as3-flash