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

Customizing preloader (information displayed)

Community Expert ,
Feb 07, 2010 Feb 07, 2010

Copy link to clipboard

Copied

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

Views

530

Translate

Translate

Report

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);

}

Votes

Translate

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

Copy link to clipboard

Copied

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);

}

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

It worked! Thanks! 

Adobe Community Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

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