In a FLA or AS file, enter the following ActionScript:
import InvalidEmailAddress;
function checkEmail(email:String) {
if (email.indexOf("@") == -1) {
throw new InvalidEmailAddress();
}
}
try {
checkEmail("Joe Smith");
} catch (e) {
this.createTextField("error_txt", this.getNextHighestDepth(), 0, 0, 100,
22);
error_txt.autoSize = true;
error_txt.text = e.toString();
}
See also
Error
class,
try..catch..finally
216
Chapter 5: ActionScript Core Language Elements
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?