Flash Player 7
Flash MX 2004.
vr_mc.onLoadError = function(error:String,code:String) {
// your statements here
}
Returns an error and code parameter
The contorlVR instance will call the onLoadError for any error that may occur. The onLoadError will always return an error and code parameter.
The following table lists the errors and their codes which are applicable to the specific error.
| Error | Code |
|---|---|
| XMLLoadError | url |
| XMLParseError |
|
| URLNotFound | url |
| LoadNeverCompleted | url |
| VRObjectError |
|
In the following example you will have to give your controlVR instance a name vr_mc and place the following code in the main timeline. The following code will generate a text field that will display any error that the vr_mc instance may generate.
vr_mc.onLoadError = function(error ,code){
this.createTextField("error_txt",this.getNextHighestDepth(),1, 50, 200, 100);
this.error_txt.multiline = true;
this.error_txt.wordWrap = true;
this.error_txt.border = true;
this.error_txt.background = true;
trace(error+code)
if(error == "XMLLoadError"){
this.error_txt.text += "sdfdfsgfd"+" : "+code+"\n";
}
if(error == "XMLParseError"){
switch (code){
case "-2" : this.error_txt.text += error+" A CDATA section was not properly terminated.\n";
break;
case "-3" : this.error_txt.text += error+" The XML declaration was not properly terminated.\n";
break;
case "-4" : this.error_txt.text += error+" The DOCTYPE declaration was not properly terminated.\n";
break;
case "-5" : this.error_txt.text += error+" A comment was not properly terminated.\n";
break;
case "-6" : this.error_txt.text += error+" An XML element was malformed.\n";
break;
case "-7" : this.error_txt.text += error+" Out of memory.\n";
break;
case "-8" : this.error_txt.text += error+" An attribute value was not properly terminated.\n";
break;
case "-9" : this.error_txt.text += error+" A start-tag was not matched with an end-tag.\n";
break;
case "-10" : this.error_txt.text += error+" An end-tag was encountered without a matching start-tag.\n";
break;
}
}
if(error == "URLNotFound"){
this.error_txt.text = error+" : "+code+"\n";
}
if(error == "LoadNeverCompleted"){
this.error_txt.text = error+" : "+code+"\n";
}
if(error == "VRObjectError"){
switch (code){
case "-2" : this.error_txt.text += error+" Not the same amount of images per layer.\n";
break;
}
}
}