package {
import flash.display.*;
import flash.events.*
import flash.net.*;
public class Main extends Sprite {
public function Main( ) {
var streamer:URLStream = new URLStream( );
streamer.addEventListener( ProgressEvent.PROGRESS, handleProgress );
streamer.load( new URLRequest( "example.txt" ) );
}
private function handleProgress( event:ProgressEvent ):void {
var streamer:URLStream = URLStream( event.target );
while ( streamer.bytesAvailable > 0 ) {
trace( "Read byte: " + streamer.readByte( ) );
}
}
}
}
|