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

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. Thus, if a movie clip instance appears in your movie for 40 frames, it's only considered present and targetable during those 40 frames.)

The communication lines for these movie elements are provided by target paths addresses to objects (for example, movie clip instances) that begin by describing the overall area in which the object exists and then 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 the following:


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 path the complete and absolute location of Derek Franklin here on Earth. There are also relative target paths the paths you would provide to people who also live in Bloomington. To locate him, these people don't need all of the information included in the absolute path; thus, we could simply provide them with the following relative path:


A relative path as you can see from the above targets an object in relation to the object trying to locate it. Thus, if the entire city of Bloomington (Derek Franklin included) were to relocate to Paris, those people could still locate Derek Franklin using DerekFranklin . This is because even though the absolute path has changed to France.Paris.DerekFranklin , Derek Franklin's relative position (to the ex-citizens on Bloomington) remains the same.


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

You can think of a Flash project as a hierarchy of movies (where timelines can exist within other timelines), with the main, or root, movie serving as the starting point (see "Targeting the Main Movie"). When timelines exist in a hierarchical structure (as they do in Flash projects), it becomes critical that you understand how to address, or target, a timeline using target paths.


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

Macromedia Flash MX ActionScripting Advanced. Training from the Source
Macromedia Flash MX ActionScripting: Advanced Training from the Source
ISBN: 0201770229
EAN: 2147483647
Year: 2002
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net