Understanding Error Objects: throw new Error();
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var sUsername:String = "";
try {
if(sUsername == "") {
throw new Error("Missing Username.");
}
}
catch (erObject:Error) {
trace(erObject.message); // Displays: Missing Username.
}
}
}
}
Related examples in the same category