Add Process Listener to URLStream : URLStream « Network « Flash / Flex / ActionScript






Add Process Listener to URLStream

 
package
{
    import flash.net.URLStream;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    public class Main
    {
        private var streamer:URLStream= new URLStream(new URLRequest("http://example.com/binary_data.bin"));

        public function Main()
        {
            streamer.addEventListener(ProgressEvent.PROGRESS, progressListener);
        }

        private function progressListener(event:Event):void
        {
            if(streamer.bytesAvailable != 0)
            {
                trace(streamer.readByte());
            }
        }
    }
}

        








Related examples in the same category

1.Accessing Data Being Downloaded