Checking Load Progress : URLLoader : Network Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Network » URLLoader »

 

Checking Load Progress


 
package {
  import flash.display.*;
  import flash.text.*;
  import flash.events.*
  import flash.net.*;
  
  public class Main extends Sprite {
    private var _output:TextField = new TextField( );
  
    public function Main(  ) {
      _output.width = stage.stageWidth;
      _output.height = stage.stageHeight;
      
      addChild_output );    

      var loader:URLLoader = new URLLoader(  );
      
      loader.addEventListenerProgressEvent.PROGRESS, handleProgress );
      
      loader.loadnew URLRequest"example.txt" ) );
    }
    
    private function handleProgressevent:ProgressEvent ):void {
      var percent:Number = Math.roundevent.bytesLoaded 
                                       / event.bytesTotal * 100 );
      
      _output.text = " Loaded: " + event.bytesLoaded + "n"
                        "  Total: " + event.bytesTotal + "n"
                        "Percent: " + percent;
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Network
» URLLoader