566
Chapter 7: ActionScript for Flash
box_mc.onRelease = function() {
this.clear();
};
drawBox(box_mc, 10, 10, 320, 240);
function drawBox(mc:MovieClip, x:Number, y:Number, w:Number, h:Number):Void {
mc.lineStyle(0);
mc.beginFill(0xEEEEEE);
mc.moveTo(x, y);
mc.lineTo(x+w, y);
mc.lineTo(x+w, y+h);
mc.lineTo(x, y+h);
mc.lineTo(x, y);
mc.endFill();
}
See also
MovieClip.lineStyle()
MovieClip.createEmptyMovieClip()
Availability
Flash Player 6.
Usage
my_mc
.createEmptyMovieClip(
instanceName:String
,
depth:Number
)
: MovieClip
Parameters
instanceName
A string that identifies the instance name of the new movie clip.
depth
An integer that specifies the depth of the new movie clip.
Returns
A reference to the newly created movie clip.
Description
Method; creates an empty movie clip as a child of an existing movie clip. This method behaves
similarly to the
attachMovie()
method, but you don’t need to provide an external linkage
identifier for the new movie clip. The registration point for a newly created empty movie clip is
the upper left corner. This method fails if any of the parameters are missing.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Example
The following ActionScript creates a new movie clip at runtime and loads a JPEG image into the
movie clip.
this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
logo_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/
80x92/studio_flashpro.jpg");
See also
MovieClip.attachMovie()
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...