Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    64
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Preloader Problem

    Hi,

    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:

    Code:
    amountLoaded = Math.round((ns.bytesLoaded*100)/ns.bytesTotal);
    Any help appreciated, thanks.

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Code:
    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.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    New Coder
    Join Date
    Feb 2008
    Posts
    64
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Thanks i will give this a go.

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


  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Code:
    amountLoaded.substr(0,2);
    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.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •