Hi, in AS3, I have an external class ImageLoader, that loads an image upon request. In that class, I have an event handlers:
ImageLoader Class
public function loadImg(path:String):void
{
ldr = new Loader();
ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, getProgress);
var req:URLRequest = new URLRequest(path);
ldr.load(req);
}
private function getProgress(e:Event):void
{
dispatchEvent(new Event("PROGRESS_INFO"));
}
I am trying to send the download progress updates back to the main Document Class and display it on screen, so I am trying to dispatch the event "PROGRESS_INFO" and then get the information from the passed Event Object, like so:
Document Class
private function getProgressInfo(e:Event):void
{
trace(e.target.bytesTotal);
}
This however, is proving futile... any ideas on how I can get the progress info out of the IMageLoader class?
note: I know I can add bytesLoaded & bytesTotal to a public variable, but then I won't get the benefit of seeing the bytesLoaded property update in the ProgressEvent class. Any ideas?