Home arrow Flash arrow Page 3 - Making Movie Clips Perform in Flash MX
FLASH

Making Movie Clips Perform in Flash MX


Flash is the video medium of choice on the web today. If you'd like to make your movie clips viewable by more than 90 percent of web surfers, you'll want to use Flash. This article, the first of four parts, gets you off to a good start. It is excerpted from chapter 13 of the book ActionScript for Flash MX: the Definitive Guide, second edition, written by Colin Moock (O'Reilly; ISBN: 059600396X). Copyright © 2005 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 5 stars5 stars5 stars5 stars5 stars / 12
January 25, 2007
TABLE OF CONTENTS:
  1. · Making Movie Clips Perform in Flash MX
  2. · The MovieClip Class
  3. · Creating Movie Clips
  4. · Creating Instances

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Making Movie Clips Perform in Flash MX - Creating Movie Clips
(Page 3 of 4 )

We usually treat movie clips just as we treat 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 the new operator:

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

Although Flash Player 6 supports the new MovieClip( ) command, that command establishes a MovieClip subclass; it cannot be used to create a new movie clip instance in a movie. Instead, we normally 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. As of Flash Player 6, we can also create a completely new movie clip at runtime with the createEmptyMovieClip( ) method.

Movie Clip Symbols and Instances

Just as all object instances are based on a class, 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. With the exception of clips created via createEmptyMovieClip(), we generate a specific clip instance from a movie clip symbol stored in the Library. Using a symbol, we can both manually and programmatically create clips to be rendered in a movie.

A specific copy of a movie clip symbol is called an instance. Instances are the individual clip objects that can be manipulated with ActionScript; a symbol is the mold from which instances of a specific movie clip are derived. Movie clip symbols are created in the Flash authoring tool. To make a new, blank symbol, we follow these steps:

  1. Select Insert -> New Symbol. The Create New Symbol dialog box appears.
  2. In the Name field, type an identifier for the symbol.
  3. For Behavior, select the Movie Clip radio button.
  4. Click OK.

Normally, the next step is to fill the symbol’s canvas and timeline with the content of our movie clip. Once a symbol has been created, it resides in the Library, waiting for us to use it to instantiate a movie clip instance. However, it is also possible to convert a group of shapes and objects that already exist on stage into a movie clip symbol. To do so, we follow these steps:

  1. Select the desired shapes and objects.
  2. Select Insert -> Convert to Symbol.
  3. In the Name field, type an identifier for the symbol.
  4. For Behavior, select the Movie Clip radio button.
  5. Click OK.

The shapes and objects we select to create the new movie clip symbol are replaced by an unnamed instance of that new clip. The corresponding movie clip symbol appears in the Library, ready to be used to create further instances.


blog comments powered by Disqus
FLASH ARTICLES

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials