Loading a Block of Text (Including HTML and XML) : URLLoader : Network Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Network » URLLoader »

 

Loading a Block of Text (Including HTML and XML)


 
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.dataFormat = DataFormat.TEXT;
      
      loader.addEventListenerEvent.COMPLETE, handleComplete );
      
      loader.loadnew URLRequest"example.html" ) );
    }
    
    private function handleCompleteevent:Event ):void {
      var loader:URLLoader = URLLoaderevent.target );
      
      _output.htmlText = loader.data;
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Network
» URLLoader