Hi, my name is IGX and I have question :
Is there anyway in Flash to format displayed number with comma or decimal point for example : 2000000 should be displayed as 2,000,000 for more ease to our eyes, is there any available way ?
Thank you.
- IGX
Hi, my name is IGX and I have question :
Is there anyway in Flash to format displayed number with comma or decimal point for example : 2000000 should be displayed as 2,000,000 for more ease to our eyes, is there any available way ?
Thank you.
function fDisplayNumber(nNumber) {
nNumber += "", nTemp = (nNumber.length)%3;
if (nTemp>0) {
var sTemp = nNumber.substr(0, (nNumber.length)%3)+",";
} else {
var sTemp = "";
}
for (var ii = nTemp, jj = 0; ii<nNumber.length; ii++, jj++) {
if (jj%3 == 0) {
sTemp += nNumber.substr(ii, 3)+",";
}
}
sTemp = sTemp.substr(0, sTemp.length-1);
return (sTemp);
}
that should cover the commas for you.
Jeremy
Hi friend thank you for your help, but there is small small error said Flash MX, like the ā;ā and ā{ā which I dont understand where to placeā¦
mmmmm, please help me, Iām not good in thisā¦
Thank you
fNum = function(n, s) {
var n = n.toString(), l = n.length-1, i, t;
for (i=0; i<=l; i++) {
t += n.charAt(i);
if (i<l && (l-i)%3 == 0) t += s;
}
return t;
}
trace(fNum(2000000, ","));
=)
KAX AND SINFINITI IS THE GREAT.
ITāS WORKING NOW - IM SO HAPPPPPYYYY !!! :phil:
SINFINITI GAVE ME THE START
AND KAX PERFECTS IT ALRIGHT
THANK YOU MY E-FRIENDS !!!
LOVE YOU ALL
PEACE
:rambo:
glad you liked it. =)
Of Course Kax
nice one kax, i prefer your function to mine definitely!
scuse meā¦can anyone explain abit about the scriptā¦coz im not that good at itā¦and i want to learn howā¦thanksā¦
:: Copyright KIRUPA 2024 //--