
MovieClip.createTextField() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
645
this.createEmptyMovieClip("process_mc", 1);
process_mc.onEnterFrame = function () {
// perform per-frame tasks here
}
The createEmptyMovieClip() method returns a reference to the clip it creates. We can store
this reference in a variable for easy access. For example, the following code creates an
empty clip deeply nested inside an application’s interface but stores a reference to the clip
in the variable
fileMenu:
// Create the clip.
var fileMenu = appPanels.editPanel.menuBar.createEmptyMovieClip
("fileMenu_mc", 1);
// Now manipulate the clip through the variable fileMenu.
fileMenu._x = 20;
fileMenu._y = 50;
A movie clip created with createEmptyMovieClip() can be used as a mask for other clips
(see MovieClip.setMask()) and can receive button events such as onPress() and onRelease().
However, strokes and transparent fills are not recognized for masking or hit-testing for
button events.
To delete a movie clip, use MovieClip.removeMovieClip(). However, note that a movie clip
placed on a negative depth cannot be removed via removeMovieClip(). To remove a clip at
a negative depth, first swap it to a positive depth, then remove it:
theClip_mc.swapDepths(1234); // Pick a positive depth to swap to
theClip_mc.removeMovieClip(); // ...