03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Methods inherited from class Object<br />

addProperty (Object.addProperty method), hasOwnProperty<br />

(Object.hasOwnProperty method), isPropertyEnumerable<br />

(Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf<br />

method), registerClass (Object.registerClass method), toString<br />

(Object.toString method), unwatch (Object.unwatch method), valueOf<br />

(Object.valueOf method), watch (Object.watch method)<br />

Error constructor<br />

public Error([message:String])<br />

Creates a new Error object. If message is specified, its value is assigned to the objects<br />

Error.message property.<br />

Parameters<br />

message:String [optional] - A string associated with the Error object.<br />

Example<br />

In the following example, a function throws an error (with a specified message) if the two<br />

strings that are passed to it are not identical:<br />

function compareStrings(str1_str:String, str2_str:String):Void {<br />

if (str1_str != str2_str) {<br />

throw new Error("Strings do not match.");<br />

}<br />

}<br />

try {<br />

compareStrings("Dog", "dog");<br />

// output: Strings do not match.<br />

} catch (e_err:Error) {<br />

trace(e_err.toString());<br />

}<br />

See also<br />

throw statement, try..catch..finally statement<br />

message (Error.message property)<br />

public message : String<br />

Contains the message associated with the Error object. By default, the value of this property is<br />

"Error". You can specify a message property when you create an Error object by passing the<br />

error string to the Error constructor function.<br />

334 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!