O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Strict-Mode Versus Standard-Mode Compilation

ActionScript offers two different modes for compiling a program: strict mode and standard mode. In strict mode, the compiler reports more errors than in standard mode. The extra strict-mode errors are intended to help programmers locate potential sources of problems in a program before the program actually runs. Strict mode is, therefore, enabled by default in all of Adobe's compilers. Programmers who wish to use ActionScript's dynamic features (as described in Chapter 15,), or who simply prefer to solve problems (i.e., debug) at runtime rather than at compile time can choose to compile using standard mode.

The following questionable acts of programming will cause a compiler error in strict mode, but not in standard mode:

  • Supplying the wrong number or types of parameters to a function (see Chapter 8)

  • Defining two variables or methods with the same name

  • Accessing methods and variables that are not defined at compile time (but might be defined at runtime using the techniques described in Chapter 15)

  • Assigning a value to a nonexistent instance variable of an object whose class is not dynamic

  • Assigning a value to a constant variable anywhere other than the variable's initializer or, for instance variables, the constructor method of the class containing the variable's definition

  • Attempting to delete (via the delete operator) an instance method, instance variable, static method, or static variable

  • Comparing two incompatibly typed expressions (see the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required