Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Customizing preloader (information displayed)

Community Expert ,
Feb 07, 2010 Feb 07, 2010

Hi,

I am creating a simple preloader using Flash Components. The preloader displays the information about how much content has been loaded (in bytes and %). Here is the extract from the code:

function progressHandler(e:ProgressEvent):void

{

var percent:int = loadWindow.percentLoaded;

progress_txt.text = String(loadWindow.bytesLoaded) + " of " + String(loadWindow.bytesTotal) + " bytes" + " \n " + " (" + percent + " % loaded);

}

How can I change the information being displayed from bytes to kB?

Adobe Community Expert
Adobe Certified Professional
TOPICS
ActionScript
666
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 07, 2010 Feb 07, 2010

divide bytes by 1024 (and you'll probably want to round):


function progressHandler(e:ProgressEvent):void

{

var percent:int = loadWindow.percentLoaded;

progress_txt.text = String(Math.round(loadWindow.bytesLoaded/1024)) + " of " + String(Math.round(loadWindow.bytesTotal/1024)) + " kB" + " \n " + " (" + percent + " % loaded);

}

Translate
Community Expert ,
Feb 07, 2010 Feb 07, 2010

divide bytes by 1024 (and you'll probably want to round):


function progressHandler(e:ProgressEvent):void

{

var percent:int = loadWindow.percentLoaded;

progress_txt.text = String(Math.round(loadWindow.bytesLoaded/1024)) + " of " + String(Math.round(loadWindow.bytesTotal/1024)) + " kB" + " \n " + " (" + percent + " % loaded);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 12, 2010 Feb 12, 2010

It worked! Thanks! 

Adobe Community Expert
Adobe Certified Professional
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 12, 2010 Feb 12, 2010
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines