User Guide
14 Chapter 1: ActionScript Basics
• “Keywords and reserved words” on page 17
• “Constants” on page 18
Case sensitivity
In a case-sensitive programming language, variable names that differ only in case (
book and Book)
are considered different from each other. Therefore, it’s good practice to follow consistent
capitalization conventions, such as those used in this manual, to make it easy to identify names of
functions and variables in ActionScript code.
Keywords, class names, variables, method names, and so on are case sensitive. For example:
// Sets properties of two different objects
cat.hilite = true;
CAT.hilite = true;
// Creates three different variables
var myVar:Number=10;
var myvar:Number=10;
var mYvAr:Number=10;
This change also affects external variables loaded with LoadVars.load().
Case-sensitivity is implemented for external scripts, such as class files, scripts that you import
using the
#include command, and scripts in a FLA file. If you encounter runtime errors and are
exporting to more than one version of Flash Player, you should review both external script files
and scripts in FLA files to confirm that you used consistent capitalization.
Case-sensitivity is implemented on a per-movie basis. If a strict Flash Player 7 application calls a
non-strict Flash Player 6 movie, ActionScript executed in the latter movie is non-strict. For
example, if you use
loadMovie() to load a Flash Player 6 SWF into a Flash Player 7 SWF, the
version 6 SWF remains case-insensitive, while the version 7 SWF is treated as case-sensitive.
Dot syntax
In ActionScript, a dot (
.) is used to access properties or methods belonging to an object. It is also
used to identify the target path to a variable, function, or object. A dot syntax expression begins
with the name of the object followed by a dot and ends with the element you want to specify.
For example, the
_x movie clip property indicates a movie clip’s x axis position. The expression
ball_mc._x refers to the _x property of the movie clip instance ball_mc.
Expressing a method of an object follows the same pattern. For example, the
bounce() method of
the
ball object would be called as follows:
ball.bounce();
For more information, see _parent, _global object, and _root.