MovieClip class

Availability

Flash Player 3.

Description

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

You do not need to use a constructor method to call the methods of the MovieClip class; instead, you reference movie clip instances by name, using the following syntax:

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

Method summary for the MovieClip class

Method

Description

MovieClip.attachAudio()

Captures and plays local audio from the microphone hardware.

MovieClip.attachMovie()

Attaches a SWF file in the library.

MovieClip.createEmptyMovieClip()

Creates an empty movie clip.

MovieClip.createTextField()

Creates an empty text field.

MovieClip.duplicateMovieClip()

Duplicates the specified movie clip.

MovieClip.getBounds()

Returns the minimum and maximum x and y coordinates of a SWF file in a specified coordinate space.

MovieClip.getBytesLoaded()

Returns the number of bytes loaded for the specified movie clip.

MovieClip.getBytesTotal()

Returns the size of the movie clip, in bytes.

MovieClip.getDepth()

Returns the depth of a movie clip.

MovieClip.getInstanceAtDepth()

Specifies whether a particular depth is already occupied by a movie clip.

MovieClip.getNextHighestDepth()

Specifies a depth value that you can pass to other methods to to ensure that Flash renders the movie clip in front of all other objects in the current movie clip.

MovieClip.getSWFVersion()

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

MovieClip.getTextSnapshot()

Returns a TextSnapshot object that contains the text in the static text fields in the specified movie clip.

MovieClip.getURL()

Retrieves a document from a URL.

MovieClip.globalToLocal()

Converts the point object from Stage coordinates to the local coordinates of the specified movie clip.

MovieClip.gotoAndPlay()

Sends the playhead to a specific frame in the movie clip and plays the SWF file.

MovieClip.gotoAndStop()

Sends the playhead to a specific frame in the movie clip and stops the SWF file.

MovieClip.hitTest()

Returns true if bounding box of the specified movie clip intersects the bounding box of the target movie clip.

MovieClip.loadMovie()

Loads the specified SWF file into the movie clip.

MovieClip.loadVariables()

Loads variables from a URL or other location into the movie clip.

MovieClip.localToGlobal()

Converts a point object from the local coordinates of the movie clip to the global Stage coordinates.

MovieClip.nextFrame()

Sends the playhead to the next frame of the movie clip.

MovieClip.play()

Plays the specified movie clip.

MovieClip.prevFrame()

Sends the playhead to the previous frame of the movie clip.

MovieClip.removeMovieClip()

Removes the movie clip from the Timeline if it was created with duplicateMovieClip(), MovieClip.duplicateMovieClip(), or MovieClip.attachMovie().

MovieClip.setMask()

Specifies a movie clip as a mask for another movie clip.

MovieClip.startDrag()

Specifies a movie clip as draggable and begins dragging the movie clip.

MovieClip.stop()

Stops the currently playing SWF file.

MovieClip.stopDrag()

Stops the dragging of any movie clip that is being dragged.

MovieClip.swapDepths()

Swaps the depth level of two SWF files.

MovieClip.unloadMovie()

Removes a SWF file that was loaded with loadMovie().

Drawing method summary for the MovieClip class

Method

Description

MovieClip.beginFill()

Begins drawing a fill on the Stage.

MovieClip.beginGradientFill()

Begins drawing a gradient fill on the Stage.

MovieClip.clear()

Removes all the drawing commands associated with a movie clip instance.

MovieClip.curveTo()

Draws a curve using the latest line style.

MovieClip.endFill()

Ends the fill specified by beginFill() or beginGradientFill().

MovieClip.lineStyle()

Defines the stroke of lines created with the lineTo() and curveTo() methods.

MovieClip.lineTo()

Draws a line using the current line style.

MovieClip.moveTo()

Moves the current drawing position to specified coordinates.

Property summary for the MovieClip class

Property

Description

MovieClip._alpha

The transparency value of a movie clip instance.

MovieClip._currentframe

The frame number in which the playhead is currently located.

MovieClip._droptarget

The absolute path in slash syntax notation of the movie clip instance on which a draggable movie clip was dropped.

MovieClip.enabled

Indicates whether a button movie clip is enabled.

MovieClip.focusEnabled

Enables a movie clip to receive focus.

MovieClip._focusrect

Indicates whether a focused movie clip has a yellow rectangle around it.

MovieClip._framesloaded

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

MovieClip._height

The height of a movie clip instance, in pixels.

MovieClip.hitArea

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

MovieClip._highquality

Sets the rendering quality of a SWF file.

MovieClip.menu

Associates a ContextMenu object with a movie clip.

MovieClip._name

The instance name of a movie clip instance.

MovieClip._parent

A reference to the movie clip that encloses the movie clip.

MovieClip._rotation

The degree of rotation of a movie clip instance.

MovieClip._soundbuftime

The number of seconds before a sound starts to stream.

MovieClip.tabChildren

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

MovieClip.tabEnabled

Indicates whether a movie clip is included in tab ordering.

MovieClip.tabIndex

Indicates the tab order of an object.

MovieClip._target

The target path of a movie clip instance.

MovieClip._totalframes

The total number of frames in a movie clip instance.

MovieClip.trackAsMenu

Indicates whether other buttons can receive mouse release events.

MovieClip._url

The URL of the SWF file from which a movie clip was downloaded.

MovieClip.useHandCursor

Determines whether the hand is displayed when a user rolls over a button movie clip.

MovieClip._visible

A Boolean value that determines whether a movie clip instance is hidden or visible.

MovieClip._width

The width of a movie clip instance, in pixels.

MovieClip._x

The x coordinate of a movie clip instance

MovieClip._xmouse

The x coordinate of the mouse pointer within a movie clip instance.

MovieClip._xscale

The value specifying the percentage for horizontally scaling a movie clip.

MovieClip._y

The y coordinate of a movie clip instance.

MovieClip._ymouse

The y coordinate of the mouse pointer within a movie clip instance.

MovieClip._yscale

The value specifying the percentage for vertically scaling a movie clip.

Event handler summary for the MovieClip class

Event handler

Description

MovieClip.onData

Invoked when all the data is loaded into a movie clip.

MovieClip.onDragOut

Invoked while the pointer is outside the button; the mouse button is pressed inside, and then rolls outside the button area.

MovieClip.onDragOver

Invoked while the pointer is over the button; the mouse button has been pressed then rolled outside the button, and then rolled back over the button.

MovieClip.onEnterFrame

Invoked continually at the frame rate of the SWF file. The actions associated with the enterFrame clip event are processed before any frame actions that are attached to the affected frames.

MovieClip.onKeyDown

Invoked when a key is pressed. Use the Key.getCode() and Key.getAscii() methods to retrieve information about the last key pressed.

MovieClip.onKeyUp

Invoked when a key is released.

MovieClip.onKillFocus

Invoked when focus is removed from a button.

MovieClip.onLoad

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

MovieClip.onMouseDown

Invoked when the left mouse button is pressed.

MovieClip.onMouseMove

Invoked every time the mouse is moved.

MovieClip.onMouseUp

Invoked when the left mouse button is released.

MovieClip.onPress

Invoked when the mouse is pressed while the pointer is over a button.

MovieClip.onRelease

Invoked when the mouse is released while the pointer is over a button.

MovieClip.onReleaseOutside

Invoked when the mouse is released while the pointer is outside the button after the button is pressed while the pointer is inside the button.

MovieClip.onRollOut

Invoked when the pointer rolls outside of a button area.

MovieClip.onRollOver

Invoked when the mouse pointer rolls over a button.

MovieClip.onSetFocus

Invoked when a button has input focus and a key is released.

MovieClip.onUnload

Invokes in the first frame after the movie clip is removed from the Timeline. The actions associated with the Unload movie clip event are processed before any actions are attached to the affected frame.