User Guide
546 ActionScript classes
Method summary
Methods inherited from class Object
Error constructor
public Error([message:String])
Creates a new Error object. If message is specified, its value is assigned to the object's
Error.message property.
Availability: ActionScript 1.0; Flash Player 7
Parameters
message:String [optional] - A string associated with the Error object.
Example
In the following example, a function throws an error (with a specified message) if the two
strings that are passed to it are not identical:
function compareStrings(str1_str:String, str2_str:String):Void {
if (str1_str != str2_str) {
throw new Error("Strings do not match.");
}
}
try {
compareStrings("Dog", "dog");
// output: Strings do not match.
} catch (e_err:Error) {
trace(e_err.toString());
}
See also
throw statement, try..catch..finally statement
Modifiers Signature Description
toString() : String Returns the string "Error" by default or the value
contained in Error.message, if defined.
addProperty (Object.addProperty method), hasOwnProperty
(Object.hasOwnProperty method), isPropertyEnumerable
(Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf
method), registerClass (Object.registerClass method), toString
(Object.toString method), unwatch (Object.unwatch method), valueOf
(Object.valueOf method), watch (Object.watch method)