PDA

View Full Version : loading progress problem


ThickGraphics
11-24-2009, 03:53 PM
the file loads but the progress of the load isn't tracing.

var urRequest:URLRequest = new URLRequest('http://www.focusonmedia.com/vqs/as3/externaltext.txt');

var ulLoader:URLLoader = new URLLoader();

ulLoader.addEventListener(ProgressEvent.PROGRESS,l oaderProgressHandler);
ulLoader.addEventListener(Event.COMPLETE,loaderCom pleteHandler);

function loaderProgressHandler(evt:ProgressEvent):void {
var bLoaded:Number = evt.target.bytesLoaded;
var bTotal:Number = evt.target.bytesTotal;
trace(bLoaded + '/' + bTotal + 'has loaded');
}

function loaderCompleteHandler(evt:Event):void {
trace(evt.target.data);
}

ulLoader.load(urRequest);
:confused:

creynders
11-24-2009, 09:31 PM
How have you tested this?
If only in the Flash IDE, then it's because the txt file is loaded too quickly and it doesn't have time to register the progress.
The code seems fine, so I think that's the problem.
If you want to test how it would look on a slow connection you can use a webproxy (for instance Charles: http://www.charlesproxy.com/ ) to throttle and simulate a different download speed.

ThickGraphics
12-03-2009, 01:59 AM
i understand that the progress of the load may be to quick to see, but there should be a trace statement of the size of the file right?

creynders
12-03-2009, 06:57 AM
i understand that the progress of the load may be to quick to see, but there should be a trace statement of the size of the file right?

No, not necessarily. Typically it'll just execute the 'loaderCompleteHandler' method.

ThickGraphics
12-08-2009, 03:51 PM
ok, thank you.