Flash CS4 Professional ActionScript 2.0

MovieClip

 Object
    |
    +-MovieClip

public dynamic class MovieClip
extends  Object

The methods for the MovieClip class provide the same functionality as actions that target movie clips. Some additional methods do not have equivalent actions in the Actions toolbox in the Actions panel.

You do not use a constructor method to create a movie clip. You can choose from among three methods to create movie clip instances:

  • The attachMovie() method allows you to create a movie clip instance based on a movie clip symbol that exists in the library.
  • The createEmptyMovieClip() method allows you to create an empty movie clip instance as a child based on another movie clip.
  • The duplicateMovieClip() method allows you to create a movie clip instance based on another movie clip.

To call the methods of the MovieClip class you reference movie clip instances by name, using the following syntax, where my_mc is a movie clip instance:

my_mc.play();
my_mc.gotoAndPlay(3);

You can extend the methods and event handlers of the MovieClip class by creating a subclass.

If you modify any of the following properties of a MovieClip object that contains a motion tween, Flash Player stops the playhead in that MovieClip object: _alpha, blendMode, filters, _height, opaqueBackground, _rotation, scale9Grid, scrollRect, transform, _visible, _width, _x, _xscale, _y, or _yscale. However, it does not stop the playhead in any child MovieClip objects of that MovieClip object.

Availability: ActionScript 1.0; Flash Player 3

Property summary

Modifiers

Property

Description

 

_alpha: Number

The alpha transparency value of the movie clip.

 

blendMode: Object

The blend mode for this movie clip.

 

cacheAsBitmap: Boolean

If set to true, Flash Player caches an internal bitmap representation of the movie clip.

 

_currentframe: Number [read-only]

Returns the number of the frame in which the playhead is located in the movie clip's timeline.

 

_droptarget: String [read-only]

Returns the absolute path in slash-syntax notation of the movie clip instance on which this movie clip was dropped.

 

enabled: Boolean

A Boolean value that indicates whether a movie clip is enabled.

 

filters: Array

An indexed array containing each filter object currently associated with the movie clip.

 

focusEnabled: Boolean

Specifies whether you can programmatically assign focus to a movie clip using Selection.setFocus().

 

_focusrect: Boolean

A Boolean value that specifies whether a movie clip has a yellow rectangle around it when it has keyboard focus.

 

forceSmoothing: Boolean

A Boolean value that determines whether images that are added through the loadMovie() method and are in the same hierarchy level as the movie clip are smoothed when scaled.

 

_framesloaded: Number [read-only]

The number of frames that are loaded from a streaming SWF file.

 

_height: Number

The height of the movie clip, in pixels.

 

_highquality: Number

Deprecated since Flash Player 7. This property was deprecated in favor of MovieClip._quality.

Specifies the level of anti-aliasing applied to the current SWF file.

 

hitArea: Object

Designates another movie clip to serve as the hit area for a movie clip.

 

_lockroot: Boolean

A Boolean value that specifies what _root refers to when a SWF file is loaded into a movie clip.

 

menu: ContextMenu

Associates the specified ContextMenu object with the movie clip.

 

_name: String

The instance name of the movie clip.

 

opaqueBackground: Number

The color of the movie clip's opaque (not transparent) background of the color specified by the number (an RGB hexadecimal value).

 

_parent: MovieClip

A reference to the movie clip or object that contains the current movie clip or object.

 

_quality: String

Sets or retrieves the rendering quality used for a SWF file.

 

_rotation: Number

Specifies the rotation of the movie clip, in degrees, from its original orientation.

 

scale9Grid: Rectangle

The rectangular region that defines the nine scaling regions for the movie clip.

 

scrollRect: Object

The scrollRect property allows you to quickly scroll movie clip content and have a window viewing larger content.

 

_soundbuftime: Number

Specifies the number of seconds a sound prebuffers before it starts to stream.

 

tabChildren: Boolean

Determines whether the children of a movie clip are included in the automatic tab ordering.

 

tabEnabled: Boolean

Specifies whether the movie clip is included in automatic tab ordering.

 

tabIndex: Number

Lets you customize the tab ordering of objects in a movie.

 

_target: String [read-only]

Returns the target path of the movie clip instance, in slash notation.

 

_totalframes: Number [read-only]

The total number of frames in the movie clip instance.

 

trackAsMenu: Boolean

A Boolean value that indicates whether other buttons or movie clips can receive mouse release events.

 

transform: Transform

An object with properties pertaining to a movie clip's matrix, color transform, and pixel bounds.

 

_url: String [read-only]

Retrieves the URL of the SWF, JPEG, GIF, or PNG file from which the movie clip was downloaded.

 

useHandCursor: Boolean

A Boolean value that indicates whether the pointing hand (hand cursor) appears when the mouse rolls over a movie clip.

 

_visible: Boolean

A Boolean value that indicates whether the movie clip is visible.

 

_width: Number

The width of the movie clip, in pixels.

 

_x: Number

An integer that sets the x coordinate of a movie clip relative to the local coordinates of the parent movie clip.

 

_xmouse: Number [read-only]

Returns the x coordinate of the mouse position.

 

_xscale: Number

Determines the horizontal scale (percentage) of the movie clip as applied from the registration point of the movie clip.

 

_y: Number

Sets the y coordinate of a movie clip relative to the local coordinates of the parent movie clip.

 

_ymouse: Number [read-only]

Indicates the y coordinate of the mouse position.

 

_yscale: Number

Sets the vertical scale (percentage) of the movie clip as applied from the registration point of the movie clip.

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)

Event summary

Event

Description

onData = function() {}

Invoked when a movie clip receives data from a MovieClip.loadVariables() call.

onDragOut = function() {}

Invoked when the mouse button is pressed and the pointer rolls outside the object.

onDragOver = function() {}

Invoked when the pointer is dragged outside and then over the movie clip.

onEnterFrame = function() {}

Invoked repeatedly at the frame rate of the SWF file.

onKeyDown = function() {}

Invoked when a movie clip has input focus and user presses a key.

onKeyUp = function() {}

Invoked when a key is released.

onKillFocus = function(newFocus: Object) {}

Invoked when a movie clip loses keyboard focus.

onLoad = function() {}

Invoked when the movie clip is instantiated and appears in the timeline.

onMouseDown = function() {}

Invoked when the mouse button is pressed.

onMouseMove = function() {}

Invoked when the mouse moves.

onMouseUp = function() {}

Invoked when the mouse button is released.

onPress = function() {}

Invoked when the user clicks the mouse while the pointer is over a movie clip.

onRelease = function() {}

Invoked when a user releases the mouse button over a movie clip.

onReleaseOutside = function() {}

Invoked after a user presses the mouse button inside the movie clip area and then releases it outside the movie clip area.

onRollOut = function() {}

Invoked when a user moves the pointer outside a movie clip area.

onRollOver = function() {}

Invoked when user moves the pointer over a movie clip area.

onSetFocus = function(oldFocus: Object) {}

Invoked when a movie clip receives keyboard focus.

onUnload = function() {}

Invoked in the first frame after the movie clip is removed from the Timeline.

Method summary

Modifiers

Signature

Description

 

attachAudio(id: Object) : Void

Specifies the audio source to be played.

 

attachBitmap(bmp: BitmapData, depth: Number, [pixelSnapping: String], [smoothing: Boolean]) : Void

Attaches a bitmap image to a movie clip.

 

attachMovie(id: String, name: String, depth: Number, [initObject: Object]) : MovieClip

Takes a symbol from the library and attaches it to the movie clip.

 

beginBitmapFill(bmp: BitmapData, [matrix: Matrix], [repeat: Boolean], [smoothing: Boolean]) : Void

Fills a drawing area with a bitmap image.

 

beginFill(rgb: Number, [alpha: Number]) : Void

Indicates the beginning of a new drawing path.

 

beginGradientFill(fillType: String, colors: Array, alphas: Array, ratios: Array, matrix: Object, [spreadMethod: String], [interpolationMethod: String], [focalPointRatio: Number]) : Void

Indicates the beginning of a new drawing path.

 

clear() : Void

Removes all the graphics created during runtime by using the movie clip draw methods, including line styles specified with MovieClip.lineStyle().

 

createEmptyMovieClip(name: String, depth: Number) : MovieClip

Creates an empty movie clip as a child of an existing movie clip.

 

createTextField(instanceName: String, depth: Number, x: Number, y: Number, width: Number, height: Number) : TextField

Creates a new, empty text field as a child of the movie clip on which you call this method.

 

curveTo(controlX: Number, controlY: Number, anchorX: Number, anchorY: Number) : Void

Draws a curve using the current line style from the current drawing position to (anchorX, anchorY) using the control point that ((controlX, controlY) specifies.

 

duplicateMovieClip(name: String, depth: Number, [initObject: Object]) : MovieClip

Creates an instance of the specified movie clip while the SWF file is playing.

 

endFill() : Void

Applies a fill to the lines and curves that were since the last call to beginFill() or beginGradientFill().

 

getBounds(bounds: Object) : Object

Returns properties that are the minimum and maximum x and y coordinate values of the movie clip, based on the bounds parameter.

 

getBytesLoaded() : Number

Returns the number of bytes that have already loaded (streamed) for the movie clip.

 

getBytesTotal() : Number

Returns the size, in bytes, of the movie clip.

 

getDepth() : Number

Returns the depth of the movie clip instance.

 

getInstanceAtDepth(depth: Number) : MovieClip

Determines if a particular depth is already occupied by a movie clip.

 

getNextHighestDepth() : Number

Determines a depth value that you can pass to MovieClip.attachMovie(), MovieClip.duplicateMovieClip(), or MovieClip.createEmptyMovieClip() to ensure that Flash renders the movie clip in front of all other objects on the same level and layer in the current movie clip.

 

getRect(bounds: Object) : Object

Returns properties that are the minimum and maximum x and y coordinate values of the movie clip, based on the bounds parameter, excluding any strokes on shapes.

 

getSWFVersion() : Number

Returns an integer that indicates the Flash Player version for the movie clip was published.

 

getTextSnapshot() : TextSnapshot

Returns a TextSnapshot object that contains the text in all the static text fields in the specified movie clip; text in child movie clips is not included.

 

getURL(url: String, [window: String], [method: String]) : Void

Loads a document from the specified URL into the specified window.

 

globalToLocal(pt: Object) : Void

Converts the pt object from Stage (global) coordinates to the movie clip's (local) coordinates.

 

gotoAndPlay(frame: Object) : Void

Starts playing the SWF file at the specified frame.

 

gotoAndStop(frame: Object) : Void

Brings the playhead to the specified frame of the movie clip and stops it there.

 

hitTest() : Boolean

Evaluates the movie clip to see if it overlaps or intersects with the hit area that the target or x and y coordinate parameters identify.

 

lineGradientStyle(fillType: String, colors: Array, alphas: Array, ratios: Array, matrix: Object, [spreadMethod: String], [interpolationMethod: String], [focalPointRatio: Number]) : Void

Specifies a line style that Flash uses for subsequent calls to the lineTo() and curveTo() methods until you call the lineStyle() method or the lineGradientStyle() method with different parameters.

 

lineStyle(thickness: Number, rgb: Number, alpha: Number, pixelHinting: Boolean, noScale: String, capsStyle: String, jointStyle: String, miterLimit: Number) : Void

Specifies a line style that Flash uses for subsequent calls to the lineTo() and curveTo() methods until you call the lineStyle() method with different parameters.

 

lineTo(x: Number, y: Number) : Void

Draws a line using the current line style from the current drawing position to (x, y); the current drawing position is then set to (x, y).

 

loadMovie(url: String, [method: String]) : Void

Loads a SWF, JPEG, GIF, or PNG file into a movie clip in Flash Player while the original SWF file is playing.

 

loadVariables(url: String, [method: String]) : Void

Reads data from an external file and sets the values for variables in the movie clip.

 

localToGlobal(pt: Object) : Void

Converts the pt object from the movie clip's (local) coordinates to the Stage (global) coordinates.

 

moveTo(x: Number, y: Number) : Void

Moves the current drawing position to (x, y).

 

nextFrame() : Void

Sends the playhead to the next frame and stops it.

 

play() : Void

Moves the playhead in the timeline of the movie clip.

 

prevFrame() : Void

Sends the playhead to the previous frame and stops it.

 

removeMovieClip() : Void

Removes a movie clip instance created with duplicateMovieClip(), MovieClip.duplicateMovieClip(), MovieClip.createEmptyMovieClip(), or MovieClip.attachMovie().

 

setMask(mc: Object) : Void

Makes the movie clip in the mc parameter a mask that reveals the calling movie clip.

 

startDrag([lockCenter: Boolean], [left: Number], [top: Number], [right: Number], [bottom: Number]) : Void

Lets the user drag the specified movie clip.

 

stop() : Void

Stops the movie clip that is currently playing.

 

stopDrag() : Void

Ends a MovieClip.startDrag() method.

 

swapDepths(target: Object) : Void

Swaps the stacking, or depth level (z-order), of this movie clip with the movie clip that is specified by the target parameter or with the movie clip that currently occupies the depth level that is specified in the target parameter.

 

unloadMovie() : Void

Removes the contents of a movie clip instance.

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)