onLoadError = function(target_mc, errorCode) {}
Invoked when a file loaded with MovieClipLoader.loadClip() has failed to load. This listener can be invoked for various reasons, including if the server is down, if the file is not found, or if a security violation occurs.
Call this listener on a listener object that you add using MovieClipLoader.addListener().
The value for target_mc identifies the movie clip this call is being made for. This parameter is useful if you are loading multiple files with the same set of listeners.
For the errorCode parameter, the string "URLNotFound" is returned if neither the MovieClipLoader.onLoadStart or MovieClipLoader.onLoadComplete listener is called, for example, if a server is down or the file is not found. The string "LoadNeverCompleted" is returned if MovieClipLoader.onLoadStart was called but MovieClipLoader.onLoadComplete was not called, for example, if the download was interrupted because of server overload, server crash, and so on.
target_mc: - A movie clip loaded by a MovieClipLoader.loadClip() method.
errorCode: - A string that explains the reason for the failure.
The following example displays information in the Output panel when an image fails to load.
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String) {
trace("ERROR!");
switch (errorCode) {
case 'URLNotFound' :
trace("\t Unable to connect to URL: "+target_mc._url);
break;
case 'LoadNeverCompleted' :
trace("\t Unable to complete download: "+target_mc);
break;
}
};
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace("success");
trace(image_mcl.getProgress(target_mc).bytesTotal+" bytes loaded");
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.fakedomain.com/images/bad_hair_day.jpg", image_mc);
addListener (MovieClipLoader.addListener method), loadClip (MovieClipLoader.loadClip method), onLoadStart (MovieClipLoader.onLoadStart event listener), onLoadComplete (MovieClipLoader.onLoadComplete event listener)