As we've seen over the past several sections, ActionScript's strict compilation mode provides a valuable way to detect program errors as early as possible. Not surprisingly, in an effort to write problem-free code, many developers rely heavily on strict mode's compile-time type checking. However, as we learned in the earlier section "Untyped Variables, Parameters, Return Values, and Expressions," strict-mode's type-mismatch errors are reported for typed variables, parameters, and return values only. Any time a type annotation is accidentally omitted, the programmer loses the benefit of strict mode's compile-time type checking.
Luckily, Adobe's ActionScript compilers offer a warning mode in which missing type annotations are reported at compiletime. Developers can use those warnings to help locate accidentally omitted type annotations. In Flex Builder 2 and mxmlc, warnings for missing type annotations are enabled by default. In the Flash authoring tool, type annotation warnings must be enabled manually, using the following steps:
Using a text editor, in the Flash CS3 installation folder, under /en/Configuration/ActionScript 3.0/, open EnabledWarnings.xml.
Locate the following line:
<warning id="1008" enabled="false" label="kWarning_NoTypeDecl"> Missing type declaration.</warning>
Note that missing type-annotation warnings are issued for implicitly untyped variables, parameters, and ...