We established the key role that Movie Clips have within the Flash movie structure. By having a timeline that plays separately from other timelines, Movie Clips enable multiple events to occur independently or as part of an interaction with other Movie Clips. This explores how to manipulate movie clips beyond navigation actions such as gotoAndPlay or stop.
A Movie Clip Object is the same Movie Clip instance we’ve seen previously. Any instance of a Movie Clip is a unique object in ActionScript. However, we haven’t treated it like an object in our scripting. Before we can proceed with a discussion of Movie Clips as Flash movie assets, you need to understand what predefined characteristics are available in the Movie Clip Object. See below for more information.
An overview of the Movie Clip Object
Movie Clip properties
Each Movie Clip instance has definable properties, or attributes, that control its appearance, size, and position. For example, you can move a Movie Clip instance to a new position on the Stage by changing the value of its X or Y coordinate. This property in ActionScript is denoted as _x or _y, respectively. Some properties have values that are read-only, meaning that these values can’t be altered. One read-only property is _url, the value of which indicates the download location of the Movie Clip (or .SWF file).
All properties are preceded by the underscore ( _ ) character. In Table below, each property has an “R” (as in “read”) and/or “W” (as in “write”) designation. All properties can be read, which means that you can retrieve that property’s current value. In Flash 4, these properties were retrieved using the getProperty action. The values of some properties can also be changed, through ActionScript. The table represents these properties with the “W” designation.
Properties of the Movie Clip Object
Flash movie and movie clip properties
Movie Clip methods
Although the name might sound intimidating, don’t be scared. Methods are simply actions that are attached to objects. As you well know, Movie Clips qualify as objects in Flash. A method looks like a regular action except that it doesn’t (and in most cases, can’t) operate without a Dots notation reference to a target or an object:
As actions, interactive commands are executed from the timeline on which they are written. As methods, interactive commands are tied to specific (or dynamic) targets.Lists the methods and below reviews every method associated with the Movie Clip Object shows below. Some methods can be used with Movie Clip instances and with the entire Flash movie (_root, _level0, and so on), while others can only be used with Movie Clip instances. The “Flash 4” column indicates if the method (when used as an action) is compatible in the Flash 4 Player. Some commands need to be written in Dots notation, as a method (designated as “M” in the table) of a timeline or Movie Clip Object. Other commands can be used as actions (designed as “A” in the table), meaning that the Movie Clip Object name need not precede the command.
Methods of the Movie Clip Object
onClipEvent: The Movie Clip Object handler
Yet another exciting addition to Flash 5 ActionScript is the onClipEvent handler. In previous versions of Flash, our only event handlers were keyframes and Button instances. Now, we can add Actions to the wrapper of a Movie Clip instance meaning that these actions are not added to keyframes on the Movie Clip’s timeline. Nine events can be used with the onClipEvent handler. For a summary of these events see below.
Flash movie and movie clip methods
OnclipEvent Handler for movie clip objects
Other objects that can use the Movie Clip Object
Movie Clips can be used with other ActionScript objects to control appearance and sounds, and to manipulate data.
This object requires a Movie Clip as a target. After a new object is created with the Color() action, you can control the color effects of the targeted Movie Clip.
With this object, you can create virtual sound instances on a Movie Clip timeline, and target them for later use.
This object controls the appearance of the mouse pointer within the Flash movie Stage. After the Mouse Object is hidden, you can attach a Movie Clip Object to the X and Y coordinates of the mouse pointer.
If you’re working with XML (Extensible Markup Language) data from a server-side script or file, then you can store the output within a Movie Clip instance for better data management.
Related functions that target the Movie Clip Object
Some ActionScript functions work directly with Movie Clip instances for printing and targeting. Refer below for a summary of these functions.
Related functions with a movie clip target