The following example displays the gpUrlLoader Class with an option to load an image. Add the event listener, then call the init method with the url and the load type.
I also added a progress and Load Error Listener. With the Progress Listener, you can track bytesLoaded and bytesTotal.
var ldr:gpUrlLoader = new gpUrlLoader();
ldr.addEventListener(Event.COMPLETE, imageLoaded);
ldr.addEventListener(ProgressEvent.PROGRESS, onProgress);
ldr.addEventListener(gpUrlLoader.LOADERROR, ioError);
ldr.init('joneil.jpg', 'image');
function imageLoaded(event:Event):void {
var img:Loader = ldr.getImage();
addChild(img);
}
function onProgress(event:Event):void {
trace(ldr.urlLoader.bytesLoaded);
}
function ioError(e:Event):void {
trace('Error loading file');
}
For documentation about the gpUrlLoader AS3 Class, view the blog post.