Comparing The Error Classes - Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual

Programming actionscript 3.0
Table of Contents

Advertisement

Comparing the Error classes

ActionScript provides a number of predefined Error classes. Many of these classes are used by
Flash Player, but you can also use the same Error classes in your own code. There are two
main types of Error classes in ActionScript 3.0: ActionScript core Error classes and flash.error
package Error classes. The core Error classes are prescribed by the ECMAScript (ECMA-262)
edition 4 draft language specification. The flash.error package contents are additional classes
introduced to aid ActionScript 3.0 application development and debugging.
ECMAScript core Error classes
The ECMAScript core error classes include the Error, EvalError, RangeError, ReferenceError,
SyntaxError, TypeError, and URIError classes. Each of these classes are located in the top-level
namespace.
Class name
Description
Error
The Error class can be used for
throwing exceptions, and is the
base class for the other
exception classes defined in
ECMAScript: EvalError,
RangeError, ReferenceError,
SyntaxError, TypeError, and
URIError.
EvalError
An EvalError exception is thrown
if any parameters are passed to
the Function class's constructor
or if user code calls the
function.
RangeError
A RangeError exception is
thrown if a numeric value falls
outside of an acceptable range.
Notes
The Error class serves as the base class
for all run-time errors thrown by Flash
Player, and is the recommended base
class for any custom error classes.
In ActionScript 3.0, support for the
function has been removed and
eval()
attempts to use the function cause an
error to be thrown.
eval()
Earlier versions of Flash Player used the
function to access variables,
eval()
properties, objects, or movie clips by
name.
For example, a RangeError would be
thrown by the Timer class if a delay was
either negative or was not finite. A
RangeError could also be thrown if you
attempted to add a display object at an
invalid depth.

Comparing the Error classes

271

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents