Flash Lite 2.x and 3.0 ActionScript Language Reference

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 new movie clip. You can choose from among three methods to create new movie clip instances:

  • The attachMovie() method allows you to create a new movie clip instance based on a movie clip symbol that exists in the library.
  • The createEmptyMovieClip() method allows you to create a new, 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.

Property summary

Modifiers

Property

Description

 

_alpha:Number

The alpha transparency value 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.

 

focusEnabled:Boolean

If the value is undefined or false, a movie clip cannot receive input focus unless it is a button.

 

_focusrect:Boolean

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

 

_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.

 

_name:String

The instance name of the movie clip.

 

_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.

 

_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]

Returns the total number of frames in the movie clip instance specified in the MovieClip parameter.

 

trackAsMenu:Boolean

A Boolean value that indicates whether other buttons or movie clips can receive a release event from a mouse or stylus.

 

_url:String [read-only]

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

 

_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

Sets 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() or MovieClip.loadMovie() 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 a key is pressed.

onKeyUp = function() {}

Invoked when a key is released.

onKillFocus = function(newFocus:Object) {}

Invoked when a movie clip loses input 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 the mouse button is released over a movie clip.

onReleaseOutside = function() {}

Invoked when the mouse button is pressed inside the movie clip area and then released outside the movie clip area.

onRollOut = function() {}

Invoked when the pointer moves outside a movie clip area.

onRollOver = function() {}

Invoked when the pointer moves over a movie clip area.

onSetFocus = function(oldFocus:Object) {}

Invoked when a movie clip receives input focus.

onUnload = function() {}

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

Method summary

Modifiers

Signature

Description

 

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

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

 

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) : 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 added 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.

 

getSWFVersion() : Number

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

 

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.

 

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 lineTo() and curveTo() until you call lineStyle() 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 SWF or JPEG files 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 parameter mc 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 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 specified by the target parameter, or with the movie clip that currently occupies the depth level 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)