PDA

View Full Version : catching and displaying errors?


windec
06-12-2009, 10:32 AM
A component connects to the server and does stuff if the server is down the flash debug player shows ioerror. I try various methods in the mx:script area and in the first method flex says err cannot be found and in the second method compoent_name cannot be found. It is a pure procedural code and there are no classes whatsover. Anybody knows what is wrong here?

var err:IOError;
var err_msg:String=err.toString();
//err_msg=err.toString();
if(err.message.length>0){
labelmessage1.text= "error has occured";

}


2nd method:

try {
compoent_name.source="http://server...";

} catch (err:IOError) {

labelmessage1.text= "error has occured try again";
}

mattb
06-13-2009, 03:15 AM
Is this a Flex component, or a custom component you have written?

Generally your component will need to catch the IOError at the point in code it ocurs and rethrow a new error so that you can pick it up from your code.