xml data to dynamic text AS3 flash

萝らか妹 提交于 2019-12-25 02:02:27

问题


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(/&lt;br \/&gt;\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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!