Today's New Content
Search CMX

Advanced Search

Latest Free Content
View All
Free Content
Accessibility

Understanding the Movie Clip Architecture - Part 1: The Almighty Movie Clip

By: Joseph Balderson

Page 1 of 2

Set for printing

Next

Ever get confused by all of the different ways that Flash organizes assets and information within your FLA and your SWF? Frames and timelines and levels and layers and depths, oh my! This series will sort it all out, and give you some great tips. If you ever wanted the skinny on the Flash movie clip architecture, this be da place, mon.

In Part 1 of this series we will distinguish the fundamentals of the Flash Movie Clip Architecture: movie clips, the timeline, layers and depths. This article will also reveal the secret of "magic frame rates."

The Almighty Movie Clip

First, let us start with the almighty Movie Clip, or just "clip" for short. A movie clip in Flash is basically a container, which could be represented visually as a box. Within Flash we have the capability to place these boxes within one another. This kind of movie clip "nesting" is called the "parent-child relationship."


Image 1: The movie clip parent-child relationship

In the diagram above we can see three movie clips represented, two of which are nested within other movie clips. The _root timeline is called the 'parent' of both clip1_mc and clip2_mc, as both of these clips are nested within.

We nest clips within one another in Flash by dragging a clip from the library onto the stage. What 'stage', or timeline we currently have open within Flash determines the parent movie clip that we have just dragged our clip into. To get the above parent-child clip relationship, follow these steps:

  1. Create an empty movie clip in the library named clip1.
  2. Place your empty clip on the root timeline stage by dragging it from the library and giving it an instance name of clip1_mc.
  3. Double-click on clip1_mc on the stage, taking you 'into' that clip.
  4. Create another empty clip in the library named clip2.
  5. Drag clip2 from the library onto the stage and give it an instance name of clip2_mc.
  6. Navigate back to the root timeline, click anywhere on the root timeline, and show the Actions Panel by selecting Window > Actions, or F9 (PC) / Opt+F9 (Mac).
  7. Click on the Insert Target Path crosshair button icon. You will see the following dialog box:


    Image 2: Nested clip structure

  8. Select Absolute, and click on clip2_mc in the diagram. You should see code in the top textfield appear as it does in the above illustration.

This perfectly illustrates the nested clip, or parent-chlid relationship we spoke about earlier. clip1_mc is considered a 'child' of _root and a 'parent' of clip2_mcclip2_mc is considered a 'child' of clip1_mc, and 'parent' to none because it has no other clips inside it.

To access or reference a movie clip instance within another clip, we use the dot syntax. By comparison, the folder structure in the Windows OS and other operating systems uses a slash syntax to drill down into child containers. In Windows those containers are folders; inside Flash they are movie clips.

Observe the the line of code at the top of the Insert Target Path window, _root.clip1_mc.clip2_mc. This is called the target path of the object, which in this case is clip2_mc . If we wanted to insert this target path into our code window, as a next step we would click OK. Now we could set a variable myVar on clip2_mc's timeline by using the target path for clip2_mc in the expression _root.clip1_mc.clip2_mc.myVar = 43 .

As we can see, Movie Clips are used as Flash's generic container and are integral to the internal structure of a SWF. The root, or main timeline, is actually considered the 'master' parent movie clip in the Flash architecture. It is the parent container that envelops all other containers, in much the same way the Object class is the 'master' superclass for all other classes within Flash, or the <HTML> tag defines the master container in a web document. Because of this, for the rest of this article we will use the term 'movie clip' to include the main or root timeline.

In this series we will speak about SWFs and FLAs, depending on whether we are talking about the 'project' file or the 'finished' file. An FLA is the .fla Flash project file containing all the meta information about a project, such as layers and library items, and a SWF is the compiled or final .swf file that we use to view in the Flash Player, much the way a Photoshop PSD file is to a JPG/GIF or a Fireworks PNG is to a JPG/GIF file. The Flash Player is the plugin within a browser that enables us to run SWF (.swf) files. It is the Flash 'engine' so to speak.

Page 1 of 2 1 2 Next


download
Download Support Files


Keywords
fla, swf, level, layer, frame, label, depth, architecture, movie clip, depth stack, drawing api, 5d, scenes, screens, slides, runtime, authortime, application