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.addEventListener( Event.COMPLETE, handleComplete );
loader.load( new URLRequest( "example.html" ) );
}
private function handleComplete( event:Event ):void {
var loader:URLLoader = URLLoader( event.target );
_output.htmlText = loader.data;
}
}
}
Related examples in the same category