This piece of code is from Adobe docs:
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
public class LoaderExample extends Sprite {
private var url:String = "Image.gif";
public function LoaderExample() {
var loader:Loader = new Loader();
configureListeners(loader.contentLoaderInfo);
loader.addEventListener(MouseEvent.CLICK, clickHandler);
var request:URLRequest = new URLRequest(url);
loader.load(request);
addChild(loader);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(Event.INIT, initHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(Event.UNLOAD, unLoadHandler);
}
private function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
//...
}
Can anyone tell me why loader.contenLoaderInfo (passed as an argument to configureListeners) is an IEventDispatcher (and not a LoaderInfo) object?