If you want to catch any invisible errors, you can use the standard try-catch block.
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener("complete", ldrDone);
ldr.contentLoaderInfo.addEventListener("ioError", ldrError);
ldr.load(new URLRequest("FILE-NAME-COMES-HERE"));
function ldrDone(evt:*):void
{
var temp:*;
try
{
temp = evt.target.content;
stage.addChild(temp);
var classOfObject:String = flash.utils.getQualifiedClassName(temp);
trace(classOfObject);
}
catch(error:*)
{
trace("some error was caught, for example swf is AS2, or whatever, like Error #2180");
}
}
function ldrError(evt:*):void
{
trace("this is the error part, Error #2124 won't show up");
}
This catches errors, for example, the swf you are trying to download is the old swf (published with AS2) - Error # 2180.
If the file cannot be found or does not look like any downloadable format, then the ioError operation is performed - Error # 2124.
source
share