![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
In ActionScript, a dot (.
) is used to indicate the properties or methods related 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 ballMC._x
refers to the _x
property of the movie clip instance ballMC
.
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 play()
method of the ball_mc
movie clip instance moves the playhead in the Timeline of ball_mc
, as shown in the following statement:
ball_mc
.play();
Dot syntax also uses two special aliases, _root
and _parent
. 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:
_parent.stop();
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |