User Guide

272 Handling Errors
ReferenceError A ReferenceError exception is
thrown when a reference to an
undefined property is attempted
on a sealed (nondynamic) object.
Versions of the ActionScript
compiler before ActionScript 3.0
did not throw an error when
access was attempted to a
property that was undefined.
However, because the new
ECMAScript specification
specifies that an error should be
thrown in this condition,
ActionScript 3.0 throws the
ReferenceError exception.
Exceptions for undefined variables point
to potential bugs, helping you improve
software quality. However, if you are not
used to having to initialize your variables,
this new ActionScript behavior may
require some changes in your coding
habits.
SyntaxError A SyntaxError exception is
thrown when a parsing error
occurs in your ActionScript code.
For more information, see
Section 15.11.6.4 of the
ECMAScript (ECMA-262)
edition 3 (until edition 4 is
available) language specification
at www.ecma-international.org/
publications/standards/Ecma-
262.htm, as well as Section
10.3.1 of the ECMAScript for
XML (E4X) specification
(ECMA-357 edition 2) at
www.ecma-international.org/
publications/standards/Ecma-
357.htm.
A SyntaxError can be thrown under the
following circumstances:
ActionScript throws SyntaxError
exceptions when an invalid regular
expression is parsed by the RegExp
class.
ActionScript throws SyntaxError
exceptions when invalid XML is parsed
by the XMLDocument class.
Class name Description Notes