Understanding Multiple Timelines

Every project includes a main timeline. But projects also include movie clip instances that have timelines of their own. You can use the loadMovie() action to add external SWFs to a project, thereby adding even more timelines. Therefore, a single project can have many separate timelines, all of which can act independently, with their own variables, properties, objects, and functions.

However, these timelines can also work together: one timeline can control another. In fact, any timeline present in a scene can tell another present timeline to do something. (Timelines are considered present as long as they exist in the Player movie window. If a movie clip instance appears in your movie for 40 frames, it's considered presentand targetableonly during those 40 frames.)

The communication lines for these movie elements are provided by target pathsaddresses to objects (movie clip instances, for example) that describe the overall area in which the object exists and narrow that area with each subsequent level. To better understand this concept, take a look at the following example. The target path to one of your authors would look something like this:

graphics/03inf02.gif

This target path contains four levels, separated by dots, with each subsequent level smaller in size and scope until you reach the target: Derek Franklin. This is what's known as an absolute paththe complete and absolute location of Derek Franklin here on Earth. If someone in Australia wanted to communicate with Derek (using a hypothetical communication system), he or she would use this absolute address.

In addition to absolute target paths, there are also relative target pathsa slightly trickier concept to understand, so let's consider an example. If someone in Bloomington wanted to communicate with Derek (who is also in Bloomington), a lot of the information included in the absolute path would be unnecessary (country, state, city) because both people exist in a position relative to one another: Bloomington. The following relative path would suffice:


DerekFranklin


Relative paths are powerful because they enable you to script a "chunk" of timelines to work together, in a unique way, based on their relationship. As long as these timelines' relative relationship remains the same, they'll continue to work togethereven if you move them to another location in your project, or to another project altogether.

Think of a Flash project as a hierarchy of movies, where timelines exist within other timelines and where the main, or root, movie serves as the starting point (see the section titled "Targeting the Main Movie" on page 114). When timelines exist in a hierarchical structure, as they do in Flash projects, it is critical that you understand how to address, or target, a timeline using target paths.

graphics/03inf03.gif

You will use target paths not only to alter timelines but to access their data, functions, objects, and so on.