User Guide
Syntax 29
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.
When syntax coloring is enabled, language elements written with correct capitalization are blue
by default. For more information, see “Keywords and reserved words” on page 32 and “Syntax
highlighting” on page 144.
Dot syntax
In ActionScript, a dot (
.) is used to access properties or methods belonging to an object or movie
clip. It is also used to identify the target path to a movie clip, variable, function, or object. A dot
syntax expression begins with the name of the object or movie clip 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 on the Stage. The
expression
ball_mc._x refers to the _x property of the movie clip instance ball_mc.
As another example,
submit is a variable set in the form movie clip, which is nested inside the
movie clip
shoppingCart. The expression shoppingCart.form.submit = true sets the submit
variable of the instance
form to true.
Expressing a method of an object or movie clip follows the same pattern. For example, the
bounce() method of the ball object would be called as follows:
ball.bounce();
Dot syntax also uses three special aliases, _root, _parent, and _global. The alias _root refers
to the main Timeline. You can use the
_root alias to create an absolute target path. For example,
the following statement calls the function
buildGameBoard() in the movie clip functions on
the main Timeline:
_root.functions.buildGameBoard();
You can use the alias _parent to refer to a movie clip in which the current object is nested. You
can also use
_parent to create a relative target path. For example, if the movie clip dog_mc is
nested inside the movie clip
animal_mc, the following statement on the instance dog_mc tells
animal_mc to stop:
this._parent.stop();
You can use the alias _global to indicate, without having to use a target path, that an object is
available to all Timelines in your document. For example, the following statement defines the
function
response that is available to all Timelines:
_global.response = function() {
if (myVar <= 19) {
myResponse = "25% discount for 20 or more orders";
} else {
myResponse = "Thanks for your order";
}
}
For more information, see _parent, _global object, and _root. in Flash ActionScript Language
Reference.