View Single Post
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator 17 Creative Assets 2007-08-20 #4 Old  
Originally posted by cmoore
...
Do you mean using a progress bar component? If you meant the text field, what would I call it?
...
It depends on what you want to do really. I added that comment into the progressListener() function because that is where you can grab the number of bytes loaded and do the percentage calculations etc, so it would be the easiest place to update your progress bar or text field.

ActionScript Code:
  1. function progressListener( event:ProgressEvent ):void
  2. {
  3.     trace( "progress = " + event.bytesLoaded );
  4.  
  5.     var percent:int = 0;
  6.  
  7.     if( event.bytesTotal > 0 && event.bytesLoaded > 0 )
  8.     {
  9.         percent = (100 / event.bytesTotal) * event.bytesLoaded;
  10.     }
  11.    
  12.     myTextField.text = percent + "%";
  13. }
Reply With Quote