Return to Snippet

Revision: 25928
at July 16, 2010 22:42 by adrianparr


Updated Code
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

Revision: 25927
at April 14, 2010 08:51 by adrianparr


Initial Code
var bytesTotal:int = loaderInfo.bytesTotal;
var mbFormatted:String = (Math.floor(((bytesTotal/1024/ 1024)*100))/100)+" MB";
trace("mbFormatted: "+mbFormatted);

// For example, if bytesTotal = 5024322 the output would be ...
// mbFormatted: 4.79 MB

Initial URL

                                

Initial Description

                                

Initial Title
AS3 Display BytesTotal as Megabytes (formatted)

Initial Tags

                                

Initial Language
ActionScript 3