Google


ADBRITE ads links
You are here: CodeIdol.com > Flash > Macromedia Flash® ActionScript: Training from the Source > Lesson8.Dynamically Creating Assets > Adding Empty Movie Clips

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

Adding Empty Movie Clips

Aside from adding movie clip instances of exported movie clip symbols, you can also programmatically add movie clip instances that have no symbol. The createEmptyMovieClip() method, as the name implies, adds a new empty movie clip instance. The benefit of an empty movie clip instance might not be immediately apparent. However, there are many cases in which it can be useful. Remember that movie clips can contain nested movie clips. If you move the parent movie clip, for example, the nested movie clips are also moved. So if you attach movie clips within an empty movie clip, the parent movie clip is a convenient way to group nested instances. Additionally, as you'll read in the next section, you can draw programmatically within a movie clip. That means that you can add a new empty movie clip and then you can draw content within that instance.

Regardless of how you intend to work with the new empty movie clip instance, you can create it the same way. The createEmptyMovieClip() method is a method of the MovieClip class, and it adds a new empty movie clip instance nested within the object from which it is called. The method requires two parameters: the new instance name and the depth at which to add the instance. The following code adds a new movie clip instance called exampleClip:

   this.createEmptyMovieClip("exampleClip", this.getNextHighestDepth());

As with the attachMovie() method, the createEmptyMovieClip() method returns a reference to the new movie clip.


SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Flash > Macromedia Flash® ActionScript: Training from the Source > Lesson8.Dynamically Creating Assets > Adding Empty Movie Clips
   
Related tags







Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......






© CodeIdol Labs, 2007