Throughout the remainer of this section, it is important for you to understand that you can have a movie clip embedded within a movie clip. This concept is similiar to how, on your computer, you can have a folder inside a folder. It should be understood that each movie clip can be named, similiar to the way that you would name a folder on your computer.

The Dot Syntax

The dot syntax simply means that we are using a "." to identify that we are now refering to something new. The best way to explain this is that in the english language we use a "period" at the end of each sentance - which indicates that one section of thought is complete and the next will begin.

There are primarily two ways to use the "dot" syntax:

1. to identify and navigate hierarchical order.

Example 1:

So there is the Universe... Inside the universe there are solar systems. Inside our solar system we have planets. On our planet there is land. On the land there are streets. On streets there are houses.

Here is how this example would look using a dot syntax:
universe.ourSolarSystem.planet.land.street.house

2. to initiate an action

Example 2:

Using the example above, we can attach an action: Go to frame number 5 and stop.

universe.ourSolarSystem.planet.land.street.house.gotoAndStop(5)

As you know there are a many "actions" which Flash is capable of executing, as in the example above, we have written an actionScript to tell the movie clip "house" embedded deep within our movie to advance to frame 5 and stop the play head. We will cover the structure of actions later on, but it is important for you to see the relation ship of how the "dot" structure enables us to mix and match navigation and execution.

So from the above examples we can see that the dot syntax enables us to kill two birds with one stone, first to navigate to the object, and then to initiate the action... This is extremely efficient. Now let's take a closer look at the structure of things.

Paths

The best way to explain this term is to take it literally. A path is like a road from one place to another. A path is a simple way of inferring the interconnectivity of elements within our hierarchy. Which means that if we wanted to get from the "planet" to the "house" we would have to understand the logical "path" from one to the other - or - we would have to understand how each item is connected to the other.

Root

There is nothing before the "root." Root is the "top level" or origin of everything. The main stage of your flash movie is the "root" of your movie. In the following example we will assume that each term listed is refering to a movie clip within a flash movie. Please refer to the Flash movie named "Dot Syntax 1" - you will see that "ourSolarSystem" is a movie clip on the main stage, not only is there a movie clip object named "ourSolarSystem" in the library, but the item is also labeled "ourSolarSystem" as defined in the "instance" pallette.

Example 3:

_root.ourSolarSystem.planet.land.street.house

In the Flash movie named "Dot Syntax 1" You can see that the hierarchy of items on the main stage matches the example above, in that there is a movie clip labeled "ourSolarSystem" which has the movie clip labeled "planet" embedded in it - and "planet" contains the movie clip named "land." and so on. The example above shows how one would write a path connecting the items together - or - thier hierarchical relationship to one another. The path listed in Example 3 is a logical path from the main stage (or "root") to the movie clip labeled "house".

There are two way to construct a path:

2. Absolute

Start from the beginning (or "root" and move forward. Using the absolute structure enables us to reference any item reguardless of the refering location. Example 3 is an example of an "absolute" path. For it shows how one can reference an item by navigating from the main stage (or "root") to the movie clip labeled "house" embbedded deep within the movie.

One of the benefits of using an "absolute" path is that you can use this type of path from anywhere in your movie, an it will always yield the same results. To create an absolute path, one simply need to start the statement with the term "_root" and properly identify items in logical succession to the target.

If we put the actionScript listed in Example 3 on a frame in the movie clip labeled "land" - The result would yield a refernece to the "house" movie clip.

Likewise, if we used the same actionScript in the "planet" movie clip - The result would yield a reference to the "house" movie clip. This is because we have placed a "_root" command at the beginning of the statement, which tells Flash to start searching for the items listed from the main stage (or "root") of our movie.

 

1. Relative

Start from your current location and move toward your target.

Let's say that in Example 3 we decide to place an actionScript on a frame in the movie clip labeled "planet" which references the movie clip "house" - The result would be written as follows:

land.street.house

Since the action is written in the "planet" movie clip, there is no need to reference the "planet" item or any item before it... Flash will read the actionScript and say "ok, here i am on a frame action in the "planet" movie clip, and i've been asked to look for an item named "land" - ahh yes here it is - right in front of me! it is a movie clip. Now what is the next item in the list to seek and/or do... hmmm, street. Now i know that "street" is not on my list of action items (or executeable items) so it must be a movie clip, or variable, or a frame label or something... oh look here it is! "street" why yes, that is a movie clip, so what is next... hmmm, house..."

Now if we used the action written above on a frame of the "street" movie clip... Flash would look around in the "street" movie clip - search for something called "land" - since there is nothing named "land" inside the "street" movie clip, Flash would think "huh, that's wierd, there is nothing named "land" inside of this movie clip, and "land" is not an "action item" so i don't know what to do." See flash can only look at it's current level in the hierarchy - and down (or at things that are lower down the hierarchical order) of it's current location... and there needs to be a logical connection. However you can issue a command to enable flash to take one step backward "up" the hierarchy chain...

Parenting

Using the "parent" nomenclature enables us to reference movie clips which are located higher in the hierarchy. Example: Let's say that we write an actionScript in a frame of the movie clip labeled "house" which references the "planet" movie clip - The result would be writen as follows:

_parent._parent._parent

Now if the same reference were placed on a frame action in the movie clip named "land" Flash would refer to "_root" since it will be "backing-up" three levels.

Parenting rule of thumb: Calling a parent will take you one level up.

As described earier, Flash reads the dot syntax in the same logical order that we would read through a paragraph. Starting from the beginning of the command, Flash will read for the first item before the "dot", determine what that item is, if it is a movie clip, Flash will "open" the movie clip, and search for the next item which was listed in the action and continue to read from left to right, searching according to the action you have written. So where ever you place your actionScript, the action will start reading forward, unless you specify, "_parent" or "_root" - "_parent" will cause Flash to start reading one level up, whereas "_root" will cause Flash to start reading from the main stage (or "root").

Please refer to the following Flash movie "Movie Clip Control 1"

In this movie there are two buttons, a purple one and a green one. Both buttons are located within the "planet" Movie Clip. And both buttons do the same thing, however, he purple one uses a "relative" path whereas the green button uses an "absolute" path.

Here is the action for the purple button:
_parent.nextFrame ();
This actioScript above uses a releative path

And here is the action for the green button:
_root.ourSolarSystem.nextFrame ();
This actioScript above uses an absolute path

"Relative" and "Absolute" These concepts are vauable not only for Flash and Actionscript, but are also useful when dealing with regular old HTML... Flash uses the "dot" syntax, while HTML (or web sites) use the "slash" syntax... What we mean by this is pretty straight forward... with the "dot" syntax we use a "." to represent the next level while the "slash" syntax uses a "/" to indicate the next level. If your familiar with a Windows based PC you know that your hard drive is refered to as "C:\" drive (or "C" drive) and inside that are a number of files and foldesr - the "C:" drive can be likened to the "root"