/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var bytesTotal:int = loaderInfo.bytesTotal; var kbFormatted:String = Math.floor(bytesTotal/1024)+" KB"; var mbFormatted:String = (Math.floor(((bytesTotal/1024/ 1024)*100))/100)+" MB"; trace("kbFormatted: "+kbFormatted); trace("mbFormatted: "+mbFormatted); // For example, if bytesTotal = 5024322 the output would be ... // kbFormatted: 4906 KB // mbFormatted: 4.79 MB