View Full Version : Preloader Problem

02-03-2009, 12:55 PM

I have had some strange reports of my dynamic text within my preloader showing lots of decimal points when loading. This seems only to happen with slow internet connections !

Can anyone offer any advice as to why this is happening? code to calculate amountLoaded below:

amountLoaded = Math.round((ns.bytesLoaded*100)/ns.bytesTotal);

Any help appreciated, thanks.

02-03-2009, 01:03 PM
amountLoaded = Math.round((ns.bytesLoaded/ns.bytesTotal)*100);

Is this not what you mean? I assume it should round fine, but perhaps you could also just have it take a substring from amountLoaded just to be sure that it only shows 2 or 3 numbers.

02-04-2009, 11:25 AM
Thanks i will give this a go.

I am trying to figure out how to limit the string size as suggested at the moment.


02-04-2009, 11:30 AM

This is how to grab a substring, starting with the first character and then taking 2 characters. That will give you the 1-99, if you want to display 100 you'll have to try something else.