Event Listener Registration Examples
package {
import flash.display.*;
import flash.net.*;
import flash.events.*;
public class Main extends Sprite {
public function Main( ) {
var urlLoader:URLLoader = new URLLoader( );
urlLoader.addEventListener(Event.COMPLETE, completeListener);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
urlLoader.load(new URLRequest("someFile.txt"));
}
private function completeListener (e:Event):void {
trace("Load complete");
}
private function ioErrorListener (e:Event):void {
trace("Error loading file.");
}
}
}
Related examples in the same category