Hi,
I'm using XML to get show players ranking and points. But I need to get rid of the decimal place, because the user doesn't need to see it. What I've come up with so far is...
The var called fix is the part of the code that I use to get ride of the decimal place. I'm using the decimal fix from code that I used in an old project, but in that project I left 2 decimal places.
I was wondering if someone could re-jog my memory or help explain.
CODE
var objPokerXml1 = new XML();
var arPokerDates1 = new Array();
objPokerXml1.ignoreWhite = true;
objPokerXml1.onLoad = function(success) {
if (success) {
var iTotalTournaments1 = objPokerXml1.childNodes[0].childNodes.length;
for (i=0; i<iTotalTournaments1; i++) {
var arTempArray = new Array();
playerName = objPokerXml1.childNodes[0].childNodes[i].attributes.id;
points = objPokerXml1.childNodes[0].childNodes[i].childNodes[0].firstChild.nodeValue;
sTempGameType = objPokerXml1.childNodes[0].childNodes[i].childNodes[1].firstChild.nodeValue;
scoinValue = objPokerXml1.childNodes[0].childNodes[i].childNodes[2].firstChild.nodeValue;
arTempArray.push(playerName);//0
arTempArray.push(points);//1
arTempArray.push(sTempGameType);//2
arTempArray.push(scoinValue);//3
arPokerDates1.push(arTempArray);
}
fnCreateText();
trace(objPokerXml1);
var fix = objPokerXml1.toString().split(".");
for (var i:Number = fix[2].length-1; i>=0; i--) {
count++;
temp = fix[0].charAt(i)+temp;
if ((count%3 == 0) && (i-1>=0)) {
temp = ","+temp;
}
trace(fix);
}
} else {
myTextFormat = new TextFormat();
myTextFormat.size = 10;
tourny_txt.setTextFormat(myTextFormat);
trace("XML FEED DOWN");
tourny_txt.text = "XML_DOWN";
_root.xml_down._visible = true;
}
};
function fnCreateText() {
// trace('arr: '+ arPokerDates1);
this.createTextField('tourny_txt',0,5,0,210,270);
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.size = 10;
myTextFormat.font = "Arial";
myTextFormat.color = 0xFFFFFF;
myTextFormat.leading = 2;
for (i=0; i<arPokerDates1.length; i++) {
_root.Scolling_text_Jackpots_mc.tourny_txt.text = tourny_txt.text+arPokerDates1[i][1]+' '+"PLAYER"+' '+arPokerDates1[i][2]+newline;
this.tourny_txt.setTextFormat(myTextFormat);
}
}
objPokerXml1.load('https://csm.softwareadmintoolbox.com/servlet/disco.TopCasinoPlayers?licenseeId=941&startDate=2009-11-01&endDate=2019-11-01&numOfPlayers=10&sortByCategoryId=2');
if (_root.up) {
this.tourney_text.scroll += 1;
} else if (_root.down_bt_mc) {
this.tourney_text.scroll -= 1;
}
this.scrollingText_mc.gotoAndPlay(1);
Thanks in advance,
Brandon