O'Reilly logo

ActionScript: The Definitive Guide by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Movie Clips

We usually treat movie clips just like data objects—we set their properties with the dot operator; we invoke their methods with the function-call operator (parentheses); and we store them in variables, array elements, and object properties. We do not, however, create movie clips in the same way we create objects. We cannot literally describe a movie clip in our code as we might describe an object with an object literal. And we cannot generate a movie clip with a movie clip constructor function, like this:

myClip = new MovieClip( );  // Nice try buddy, but it won't work

Instead, we create movie clips directly in the authoring tool, by hand. Once a clip is created, we can use commands such as duplicateMovieClip( ) and attachMovie( ) to make new, independent duplicates of it.

Movie Clip Symbols and Instances

Just as all object instances are based on one class or another, all movie clip instances are based on a template movie clip, called a symbol (sometimes called a definition). A movie clip’s symbol acts as a model for the clip’s content and structure. We must always have a movie clip symbol before we may generate a specific clip object. Using a symbol, we can both manually and programmatically create clips to be rendered in a movie.

A movie clip that is rendered on the Stage is called an instance. Instances are the individual clip objects that can be manipulated with ActionScript; a symbol is the mold from which all instances of a specific movie clip are derived. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required