Hierarchy structures in Adobe Flash and Actionscript.

Code and Objects in Actionscript are organized in a hierarchy structure. Things that live on the main timeline are considered to be at the _root.

Movie clips that are loaded into the main timeline have their own timeline and therefore have their own way of referring to their own Objects. From within that MovieClip, the _root layer is considered to be the _parent

Dot Syntax

So let's talk about how you can refer to different objects within Flash. In the old days of Actionscript, you used to use a command called TellTarget. But as of Flash 5, Actionscript recognized Dot Syntax.

Whether you know it or not, you are already familiar with Dot Syntax, because it is used to address things on the Internet.

www.CodeOfPaint.com is a different subdomain than ftp.CodeOfPaint.com.

www.CodeOfPaint.com is a different domain than www.YourDomain.com.

10.0.0.12 is a different address than 10.0.0.15, etc.

Actionscript uses a similar structure to be able to address different elements within a Flash movie. Instead of subdomains, domains, and domain suffixes, you use paths & instances to refer to objects and their properties, methods, and variables.

First let's talk about paths. If you have written much html, you may already be familiar with the differences between absolute and relative paths.

Absolute Path

An absolute path is where you refer to a Flash object using its full path from the root movie clip. An example would be:


_root.clip1.startButton
 

In this example, _root.clip1 is the path, and startButton is the instance name of the object we're trying address.

Relative Path

One loaded MovieClip might not know the absolute path to some other clip, because the path might be dynamic. A clip might be loaded as a direct child of the root, or it might loaded as a grandchild or great-grandchild, etc. And it has no way of knowing.

But it might know a relative path like this example:


_parent.characterClips.quitButton
 

The path in this example is _parent.characterClips, and the instance is quitButton