![MACROMEDIA Flash Lite 2 Скачать руководство пользователя страница 359](http://html1.mh-extra.com/html/macromedia/flash-lite-2/flash-lite-2_reference_687553359.webp)
Error
359
Error constructor
public Error([message:
String
])
Creates a new Error object. If
message
is specified, its value is assigned to the objects
Error.message
property.
Availability:
ActionScript 1.0; Flash Lite 2.0
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
message (Error.message property)
public message :
String
Contains the message associated with the Error object. By default, the value of this property is
"
Error
". You can specify a
message
property when you create an Error object by passing the
error string to the
Error
constructor function.
Availability:
ActionScript 1.0; Flash Lite 2.0
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...