Top Level

Class MovieClip

Object


public dynamic class MovieClip
extends Object

Player version: Flash Player 3

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:

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.

The MovieClip class is the base class for Flex components. However, while Macromedia supports some of the MovieClip interface for use in Flex applications, much of the interface has been overridden by Flex.




Property Summary
_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
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 keyboard 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.
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
__proto__, __resolve, constructor, prototype


Event Summary
onData = function() {}
Invoked when a movie clip receives data from a MovieClip.loadVariables() call or a 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 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
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 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 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, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch


Property Detail

_alpha Property

public _alpha : Number

Player version: Flash Player 4

The alpha transparency value of the movie clip. Valid values are 0 (fully transparent) to 100 (fully opaque). The default value is 100. Objects in a movie clip with _alpha set to 0 are active, even though they are invisible. For example, you can still click a button in a movie clip whose _alpha property is set to 0. To disable the button completely, you can set the movie clip's _visible property to false.

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

Example
The following code sets the _alpha property of a dynamically created movie clip named triangle to 50% when the mouse rolls over the movie clip. Add the following ActionScript to your FLA or AS file:
this.createEmptyMovieClip("triangle", this.getNextHighestDepth());

triangle.beginFill(0x0000FF, 100);
triangle.moveTo(10, 10);
triangle.lineTo(10, 100);
triangle.lineTo(100, 10);
triangle.lineTo(10, 10);

triangle.onRollOver = function() {
    this._alpha = 50;
};
triangle.onRollOut = function() {
    this._alpha = 100;
};

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also
Button._alpha, TextField._alpha, MovieClip._visible

blendMode Property

public blendMode : Object

Player version: Flash Player 8

The blend mode for this movie clip. The blend mode affects the appearance of the movie clip when it is in a layer above another object onscreen.

Flash Player applies the blendMode property on each pixel of the movie clip. Each pixel is composed of three constituent colors (red, green, and blue), and each constituent color has a value between 0x00 and 0xFF. Flash Player compares each constituent color of one pixel in the movie clip with the corresponding color of the pixel in the background. For example, if blendMode is set to "lighten", Flash Player compares the red value of the movie clip with the red value of the background, and uses the lighter of the two as the value for the red component of the displayed color.

The following table describes the blendMode settings. To set the blendMode property, you can use either an integer from 1 to 14 or a string. The illustrations in the table show blendMode values applied to a circular movie clip (2) superimposed on another onscreen object (1).

Integer value String value Illustration Description
1 "normal" The movie clip appears in front of the background. Pixel values of the movie clip override those of the background. Where the movie clip is transparent, the background is visible.
2 "layer" Forces the creation of a temporary buffer for precomposition for the movie clip. This is done automatically if there is more than one child object in a movie clip and a blendMode setting other than "normal" is selected for the child.
3 "multiply" Multiplies the values of the movie clip constituent colors by those of the background color, and then normalizes by dividing by 0xFF, resulting in darker colors. This setting is commonly used for shadows and depth effects.

For example, if a constituent color (such as red) of one pixel in the movie clip and the corresponding color of the pixel in the background both have the value 0x88, the multiplied result is 0x4840. Dividing by 0xFF yields a value of 0x48 for that constituent color, which is a darker shade than that of the movie clip or that of the background.

4 "screen" Multiplies the complement (inverse) of the movie clip color by the complement of the background color, resulting in a bleaching effect. This setting is commonly used for highlights or to remove black areas of the movie clip.
5 "lighten" Selects the lighter of the constituent colors of the movie clip and those of the background (the ones with the larger values). This setting is commonly used for superimposing type.

For example, if the movie clip has a pixel with an RGB value of 0xFFCC33, and the background pixel has an RGB value of 0xDDF800, then the resulting RGB value for the displayed pixel is 0xFFF833 (because 0xFF > 0xDD, 0xCC < 0xF8, and 0x33 > 0x00 = 33).

6 "darken" Selects the darker of the constituent colors of the movie clip and those of the background (the ones with the smaller values). This setting is commonly used for superimposing type.

For example, if the movie clip has a pixel with an RGB value of 0xFFCC33, and the background pixel has an RGB value of 0xDDF800, the resulting RGB value for the displayed pixel is 0xDDCC00 (because 0xFF > 0xDD, 0xCC < 0xF8, and 0x33 > 0x00 = 33).

7 "difference" Compares the constituent colors of the movie clip with those of its background, and subtracts the darker of the values of the two constituent colors from the lighter one. This setting is commonly used for more vibrant colors.

For example, if the movie clip has a pixel with a RGB value of 0xFFCC33, and the background pixel has an RGB value of 0xDDF800, the resulting RGB value for the displayed pixel is 0x222C33 (because 0xFF - 0xDD = 0x22, 0xF8 - 0xCC = 0x2C, and 0x33 - 0x00 = 0x33).

8 "add" Adds the values of the constituent colors of the movie clip to those of its background, applying a ceiling of 0xFF. This setting is commonly used for animating a lightening dissolve between two objects.

For example, if the movie clip has a pixel with an RGB value of 0xAAA633, and the background pixel has an RGB value of 0xDD2200, the resulting RGB value for the displayed pixel is 0xFFC833 (because 0xAA + 0xDD > 0xFF, 0xA6 + 0x22 = 0xC8, and 0x33 + 0x00 = 0x33).

9 "subtract" Subtracts the values of the constituent colors in the movie clip from those of the background, applying a floor of 0. This setting is commonly used for animating a darkening dissolve between two objects.

For example, if the movie clip has a pixel with an RGB value of 0xAA2233, and the background pixel has an RGB value of 0xDDA600, the resulting RGB value for the displayed pixel is 0x338400 (because 0xDD - 0xAA = 0x33, 0xA6 - 0x22 = 0x84, and 0x00 - 0x33 < 0x00).

10 "invert" Inverts the background.
11 "alpha" Applies the alpha value of each pixel of the movie clip to the background. This requires the "layer" blendMode setting to be applied to a parent movie clip. For example, in the illustration, the parent movie clip, which is a white background, has blendMode = "layer".
12 "erase" Erases the background based on the alpha value of the movie clip. This requires the "layer" blendMode to be applied to a parent movie clip. For example, in the illustration, the parent movie clip, which is a white background, has blendMode = "layer".
13 "overlay" Adjusts the color of each bitmap based on the darkness of the background. If the background is lighter than 50% gray, the movie clip and background colors are screened, which results in a lighter color. If the background is darker than 50% gray, the colors are multiplied, which results in a darker color. This setting is commonly used for shading effects.
14 "hardlight" Adjusts the color of each bitmap based on the darkness of the movie clip. If the movie clip is lighter than 50% gray, the movie clip and background colors are screened, which results in a lighter color. If the movie clip is darker than 50% gray, the colors are multiplied, which results in a darker color. This setting is commonly used for shading effects.

If you attempt to set the blendMode property to any other value, Flash Player sets it to "normal".

However, if you set the property to an integer, Flash Player converts the value to the corresponding string version:

this.createEmptyMovieClip("mclip", this.getNextHighestDepth());
mclip.blendMode = 8;
trace (mclip.blendMode) // add

Example
The following example sets up two movie clips with gradient fills, and changes the blend mode of the one in the foreground every second. In order to have the "alpha" blend mode show up with an effect, the gradient for the mc2 movie clip includes a range of alpha ratios, and the "layer" blend mode is applied to the parent movie clip (this.blendMode="layer").
    this.createEmptyMovieClip("mc1", this.getNextHighestDepth());
    this.createEmptyMovieClip("mc2", this.getNextHighestDepth());
    this.blendMode="layer";
    this.createTextField("blendLabel", this.getNextHighestDepth(), 50, 150, 100, 100)
    
    fillClip(mc1, 0x00AA00, 0x22FFFF, 100, 100)
    fillClip(mc2, 0xFF0000, 0x2211FF, 100, 50)
    mc2._x = 33;
    mc2._y = 33;
    
    var blendModeIndex = 0;
    
    setInterval(changeBlendMode, 1000);
    function changeBlendMode() 
    {
        mc2.blendMode = blendModeIndex % 14 + 1 ;
            // values 1 - 14
    blendLabel.text = (blendModeIndex% 14 + 1) + ": " + mc2.blendMode;
        blendModeIndex++;
    }
    
    function fillClip(mc:MovieClip, color1:Number, color2:Number,
                alpha1:Number, alpha2: Number) 
{
        matrix = {a:100, b:0, c:0, d:0, e:100, f:0, g:50, h:20, i:1};
        mc.beginGradientFill("linear", [color1, color2], [alpha1, alpha2], [0, 0xFF], matrix);
        mc.lineStyle(8,0x888888,100)
        mc.moveTo(0, 0);
        mc.lineTo(0, 100);
        mc.lineTo(100, 100);
        mc.lineTo(100, 0);
        mc.lineTo(0, 0);
        mc.endFill();
    }

If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in the previous example.


cacheAsBitmap Property

public cacheAsBitmap : Boolean

Player version: Flash Player 8

If set to true, Flash Player caches an internal bitmap representation of the movie clip. This can increase performance for movie clips that contain complex vector content.

All vector data for a movie clip that has a cached bitmap is drawn to the bitmap instead of to the main Stage. The bitmap is then copied to the main Stage as unstretched, unrotated pixels snapped to the nearest pixel boundaries. Pixels are mapped one to one with the parent object. If the bounds of the bitmap change, the bitmap is recreated instead of being stretched.

No internal bitmap is created unless the cacheAsBitmap property is set to true.

After you set a movie clip's cacheAsBitmap property to true, the rendering does not change, however the movie clip performs pixel snapping automatically. The animation speed can be significantly faster, depending on the complexity of the vector content.

The cacheAsBitmap property is automatically set to true whenever you apply a filter to a movie clip (when its filter array is not empty). If a movie clip has a filter applied to it, cacheAsBitmap is reported as true for that movie clip, even if you set the property to false. If you clear all filters for a movie clip, the cacheAsBitmap setting changes to what it was last set to.

In the following cases a movie clip does not use a bitmap even if the cacheAsBitmap property is set to true, and instead renders the movie clip from vector data:

The cacheAsBitmap property is best used with movie clips that have mostly static content and that do not scale and rotate frequently. With such movie clips, cacheAsBitmap can lead to performance increases when the movie clip is translated (when its x and y position is changed).

Example
The following example applies a drop shadow to a movie clip instance. It then traces the value of the cacheAsBitmap property which is set to true when a filter is applied.
import flash.filters.DropShadowFilter;

var container:MovieClip = setUpShape();
trace(container.cacheAsBitmap); // false
var dropShadow:DropShadowFilter = new DropShadowFilter(6, 45, 0x000000, 50, 5, 5, 1, 2, false, false, false); 
container.filters = new Array(dropShadow);
trace(container.cacheAsBitmap); // true

function setUpShape():MovieClip {
    var mc:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
    mc._x = 10;
    mc._y = 10;
    var w:Number = 50;
    var h:Number = 50;
    mc.beginFill(0xFFCC00);
    mc.lineTo(w, 0);
    mc.lineTo(w, h);
    mc.lineTo(0, h);
    mc.lineTo(0, 0);
    mc.endFill();
    return mc;
}

See also
MovieClip.opaqueBackground, MovieClip.cacheAsBitmap

_currentframe Property

public _currentframe : Number  [read-only]

Player version: Flash Player 4

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

Example
The following example uses the _currentframe property to direct the playhead of the actionClip_mc movie clip to advance five frames ahead of its current location:
actionClip_mc.gotoAndStop(actionClip_mc._currentframe + 5);


_droptarget Property

public _droptarget : String  [read-only]

Player version: Flash Player 4

Returns the absolute path in slash-syntax notation of the movie clip instance on which this movie clip was dropped. The _droptarget property always returns a path that starts with a slash (/). To compare the _droptarget property of an instance to a reference, use the eval() function to convert the returned value from slash syntax to a dot-syntax reference.

Note: You must perform this conversion if you are using ActionScript 2.0, which does not support slash syntax.

Note: This method is only supported in Macromedia Flash Lite if System.capabilities.hasMouse is true or System.capabilities.hasStylus is true.

Example
The following example evaluates the _droptarget property of the garbage_mc movie clip instance and uses eval() to convert it from slash syntax to a dot syntax reference. The garbage_mc reference is then compared to the reference to the trashcan_mc movie clip instance. If the two references are equivalent, the visibility of garbage_mc is set to false. If they are not equivalent, the garbage instance resets to its original position.
origX = garbage_mc._x;
origY = garbage_mc._y;
garbage_mc.onPress = function() {
    this.startDrag();
};
garbage_mc.onRelease = function() {
    this.stopDrag();
    if (eval(this._droptarget) == trashcan_mc) {
    this._visible = false;
    } else {
    this._x = origX;
    this._y = origY;
    }
};

See also
MovieClip.startDrag(), MovieClip.stopDrag(), eval()

enabled Property

public enabled : Boolean

Player version: Flash Player 6

A Boolean value that indicates whether a movie clip is enabled. The default value of enabled is true. If enabled is set to false, the movie clip's callback methods and on action event handlers are no longer invoked, and the Over, Down, and Up frames are disabled. The enabled property does not affect the Timeline of the movie clip; if a movie clip is playing, it continues to play. The movie clip continues to receive movie clip events (for example, mouseDown, mouseUp, keyDown, and keyUp).

The enabled property only governs the button-like properties of a movie clip. You can change the enabled property at any time; the modified movie clip is immediately enabled or disabled. The enabled property can be read out of a prototype object. If enabled is set to false, the object is not included in automatic tab ordering.

Example
The following example disables the circle_mc movie clip when the user clicks it:
circle_mc.onRelease = function() {
    trace("disabling the "+this._name+" movie clip.");
    this.enabled = false;
};


filters Property

public filters : Array

Player version: Flash Player 8

An indexed array containing each filter object currently associated with the movie clip. The flash.filters package contains several classes that define specific filters you can use.

Filters can be applied in the Flash authoring tool at design-time, or at runtime using ActionScript code. To apply a filter using ActionScript, you must make a temporary copy of the entire MovieClip.filters array, modify the temporary array, and then assign the value of the temporary array back to the MovieClip.filters array. You cannot directly add a new filter object to the MovieClip.filters array. The following code has no effect on the target movie clip, named myMC:

myMC.filters[0].push(myDropShadow);

To add a filter using ActionScript, you must follow the following steps (assume that the target movie clip is named myMC):

If the filters array is empty, you need not use a temporary array. Instead, you can directly assign an array literal that contains one or more filter objects that you created.

To modify an existing filter object, whether it was created at design-time or at runtime, you must use the technique of modifying a copy of the filters array:

To clear the filters for a movie clip, set filters to an empty array ([]).

At load time, if a movie clip has an associated filter, it is marked to cache itself as a transparent bitmap. From this point forward, as long as the movie clip has a valid filter list, the player caches the movie clip as a bitmap. This source bitmap is used as a source image for the filter effects. Each movie clip usually has two bitmaps: one with the original unfiltered source movie clip and another for the final image after filtering. The final image is used when rendering. As long as the movie clip does not change, the final image does not need updating.

If you are working with a filters array that contains multiple filters and you need to track the type of filter assigned to each array index, you can maintain your own filters array and use a separate data structure to track the type of filter associated with each array index. There is no simple way to determine the type of filter associated with each filters array index.

Example
The following example adds a drop shadow filter to a movie clip named myMC:
var myDropFilter = new flash.filters.DropShadowFilter();
var myFilters:Array = myMC.filters;
myFilters.push(myDropFilter);
myMC.filters = myFilters;

The following example changes the quality setting of the first filter in the array to 15 (this example works only if at least one filter object has been associated with the myMC movie clip):

var myList:Array = myMC.filters;
myList[0].quality = 15;
myMC.filters = myList;

See also
flash.filters package

focusEnabled Property

public focusEnabled : Boolean

Player version: Flash Player 6

If the value is undefined or false, a movie clip cannot receive input focus unless it is a button. If the focusEnabled property value is true, a movie clip can receive input focus even if it is not a button.

Example
The following example sets the focusEnabled property for the movie clip my_mc to false:
my_mc.focusEnabled = false;


_focusrect Property

public _focusrect : Boolean

Player version: Flash Player 6

A Boolean value that specifies whether a movie clip has a yellow rectangle around it when it has keyboard focus. This property can override the global _focusrect property. The default value of the _focusrect property of a movie clip instance is null; this means that the movie clip instance does not override the global _focusrect property. If the _focusrect property of a movie clip instance is set to true or false, it overrides the setting of the global _focusrect property for the single movie clip instance.

In Flash Player 4 or Flash Player 5 SWF files, the _focusrect property controls the global _focusrect property. It is a Boolean value. This behavior was changed in Flash Player 6 and later to permit the customization of _focusrect on an individual movie-clip basis.

If the _focusrect property is set to false, keyboard navigation for that movie clip is limited to the Tab key. All other keys, including the Enter and arrow keys, are ignored. To restore full keyboard navigation, you must set _focusrect to true.

Example
This example demonstrates how to hide the yellow rectangle around a specified movie clip instance in a SWF file when it has focus in a browser window. Create three movie clips called mc1_mc, mc2_mc, and mc3_mc, and add the following ActionScript on Frame 1 of the Timeline:
mc1_mc._focusrect = true;
mc2_mc._focusrect = false;
mc3_mc._focusrect = true;

mc1_mc.onRelease = traceOnRelease;
mc3_mc.onRelease = traceOnRelease;

function traceOnRelease() {
    trace(this._name);
}

Test the SWF file in a browser window by selecting File > Publish Preview > HTML. Give the SWF focus by clicking it in the browser window, and press Tab to focus each instance. You cannot execute code for this movie clip in the browser by pressing Enter or the Spacebar when _focusrect is disabled.

Additionally, you can test your SWF file in the test environment. Select Control > Disable Keyboard Shortcuts from the main menu in the test environment. This allows you to view the focus rectangle around the instances in the SWF file.

See also
_focusrect global property, Button._focusrect

_framesloaded Property

public _framesloaded : Number  [read-only]

Player version: Flash Player 4

The number of frames that are loaded from a streaming SWF file. This property is useful for determining whether the contents of a specific frame, and all the frames before it, are loaded and are available locally in the browser. It is also useful for monitoring the downloading of large SWF files. For example, you might want to display a message to users indicating that the SWF file is loading until a specified frame in the SWF file has finished loading.

Example
The following example uses the _framesloaded property to start a SWF file when all the frames are loaded. If all the frames aren't loaded, the _xscale property of the bar_mc movie clip instance is increased proportionally to create a progress bar.

Enter the following ActionScript in Frame 1 of the Timeline:

var pctLoaded:Number = Math.round(this.getBytesLoaded()/this.getBytesTotal()*100);
bar_mc._xscale = pctLoaded;

Add the following code on Frame 2:

if (this._framesloaded < this._totalframes) {
    this.gotoAndPlay(1);
} else {
    this.gotoAndStop(3);
}

Place your content on or after Frame 3. Then add the following code on Frame 3:

stop();

See also
MovieClipLoader class

_height Property

public _height : Number

Player version: Flash Player 4

The height of the movie clip, in pixels.

Example
The following code example displays the height and width of a movie clip in the Output panelThe following code example writes the height and width of a movie clip to the log file:
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var image_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
    trace(target_mc._name+" = "+target_mc._width+" X "+target_mc._height+" pixels");
};
image_mcl.addListener(mclListener);

image_mcl.loadClip("example.jpg", image_mc);

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method.

The MovieClipLoader class used in this example requires Flash Player 7 or later.

See also
MovieClip._width

_highquality Property

public _highquality : Number

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

Player version: Flash Player 6

Specifies the level of anti-aliasing applied to the current SWF file. Specify 2 (best quality) to apply high quality with bitmap smoothing always on. Specify 1 (high quality) to apply anti-aliasing; this smooths bitmaps if the SWF file does not contain animation. Specify 0 (low quality) to prevent anti-aliasing. This property can overwrite the global _highquality property.

Example
The following ActionScript specifies that best quality anti-aliasing should be applied to the SWF file.
      my_mc._highquality = 2;
      

See also
MovieClip._quality, _quality

hitArea Property

public hitArea : Object

Player version: Flash Player 6

Designates another movie clip to serve as the hit area for a movie clip. If the hitArea property does not exist or the value is null or undefined, the movie clip itself is used as the hit area. The value of the hitArea property may be a reference to a movie clip object.

You can change the hitArea property at any time; the modified movie clip immediately uses the new hit area behavior. The movie clip designated as the hit area does not need to be visible; its graphical shape, although not visible, is still detected as the hit area.

Example
The following example sets the circle_mc movie clip as the hit area for the square_mc movie clip. Place these two movie clips on the Stage and test the document. When you click circle_mc, the square_mc movie clip traces that it was clicked.
square_mc.hitArea = circle_mc;
square_mc.onRelease = function() {
    trace("hit! "+this._name);
};

You can also set the circle_mc movie clip visible property to false to hide the hit area for square_mc.

circle_mc._visible = false;

See also
MovieClip.hitTest()

_lockroot Property

public _lockroot : Boolean

Player version: Flash Player 7

A Boolean value that specifies what _root refers to when a SWF file is loaded into a movie clip. The _lockroot property is undefined by default. You can set this property within the SWF file that is being loaded or in the handler that is loading the movie clip.

For example, suppose you have a document called Games.fla that lets a user choose a game to play, and loads the game (for example, Chess.swf) into the game_mc movie clip. Make sure that, after being loaded into Games.swf, any use of _root in Chess.swf refers to _root in Chess.swf (not _root in Games.swf). If you have access to Chess.fla and publish it to Flash Player 7 or later, you can add this statement to Chess.fla on the main Timeline:

this._lockroot = true;

If you don't have access to Chess.fla (for example, if you are loading Chess.swf from someone else's site into chess_mc), you can set the Chess.swf _lockroot property when you load it. Place the following ActionScript on the main Timeline of Games.fla:

chess_mc._lockroot = true;
In this case, Chess.swf can be published for any version of Flash Player, as long as Games.swf is published for Flash Player 7 or later.

When calling loadMovie(), set the MovieClip._lockroot property to true in the loader movie, as the following code shows. If you don't set _lockroot to true in the loader movie, any references to _root in the loaded movie point to the _root of the loader instead of the _root of the loaded movie:

myMovieClip._lockroot = true;

Example
In the following example, lockroot.fla has _lockroot applied to the main SWF file. If the SWF file is loaded into another FLA document, _root always refers to the scope of lockroot.swf, which helps prevent conflicts. Place the following ActionScript on the main Timeline of lockroot.fla:
this._lockroot = true;
_root.myVar = 1;
_root.myOtherVar = 2;
trace("from lockroot.swf");
for (i in _root) {
    trace("  "+i+" -> "+_root[i]);
}
trace("");

which traces the following information:

from lockroot.swf
myOtherVar -> 2
myVar -> 1
_lockroot -> true
$version -> WIN 7,0,19,0

The following example loads two SWF files, lockroot.swf and nolockroot.swf. The lockroot.fla document contains the ActionScript from the preceding example. The nolockroot.fla file has the following code added to Frame 1 of the Timeline:

_root.myVar = 1;
_root.myOtherVar = 2;
trace("from nolockroot.swf");
for (i in _root) {
    trace("  "+i+" -> "+_root[i]);
}
trace("");

The lockroot.swf file has _lockroot applied to it, and nolockroot.swf does not. After the files are loaded, each file outputs the values variables from their _root scopes. Place the following ActionScript on the main Timeline of a FLA document:

this.createEmptyMovieClip("lockroot_mc", this.getNextHighestDepth());
lockroot_mc.loadMovie("lockroot.swf");
this.createEmptyMovieClip("nolockroot_mc", this.getNextHighestDepth());
nolockroot_mc.loadMovie("nolockroot.swf");
function dumpRoot() {
    trace("from current SWF file");
    for (i in _root) {
    trace("  "+i+" -> "+_root[i]);
    }
    trace("");
}
dumpRoot();

which traces the following information:

      
      from current SWF file
      dumpRoot -> [type Function]
      $version -> WIN 7,0,19,0
      nolockroot_mc -> _level0.nolockroot_mc
      lockroot_mc -> _level0.lockroot_mc
      
      from nolockroot.swf
      myVar -> 1
      i -> lockroot_mc
      dumpRoot -> [type Function]
      $version -> WIN 7,0,19,0
      nolockroot_mc -> _level0.nolockroot_mc
      lockroot_mc -> _level0.lockroot_mc
      
      from lockroot.swf
      myOtherVar -> 2
      myVar -> 1
      
      

The file with no _lockroot applied also contains all of the other variables that the root SWF file contains. If you don't have access to the nolockroot.fla, you can use the following ActionScript added to the main Timeline to change the _lockroot in the preceding main FLA document:

this.createEmptyMovieClip("nolockroot_mc", this.getNextHighestDepth());
nolockroot_mc._lockroot = true;
nolockroot_mc.loadMovie("nolockroot.swf");

which then traces the following:


      from current SWF file
      dumpRoot -> [type Function]
      $version -> WIN 7,0,19,0
      nolockroot_mc -> _level0.nolockroot_mc
      lockroot_mc -> _level0.lockroot_mc
      
      from nolockroot.swf
      myOtherVar -> 2
      myVar -> 1
      
      from lockroot.swf
      myOtherVar -> 2
      myVar -> 1
      

See also
_root, MovieClip._lockroot, MovieClip.attachMovie(), MovieClip.loadMovie(), MovieClipLoader.onLoadInit

menu Property

public menu : ContextMenu

Player version: Flash Player 7

Associates the specified ContextMenu object with the movie clip. The ContextMenu class lets you modify the context menu that appears when the user right-clicks (Windows) or Control-clicks (Macintosh) in Flash Player.

Example
The following example assigns the menu_cm ContextMenu object to the image_mc movie clip. The ContextMenu object contains a custom menu item labeled "View Image in Browser" that has an associated function named viewImage():
var menu_cm:ContextMenu = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem("View Image in Browser...", viewImage));
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
    target_mc.menu = menu_cm;
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("photo1.jpg", image_mc);

function viewImage(target_mc:MovieClip, obj:Object) {
    getURL(target_mc._url, "_blank");
}

When you right-click (Windows) or Control-click (Macintosh) the image at runtime, select View Image in Browser from the context menu to open the image in a browser window.

See also
Button.menu, ContextMenu class, ContextMenuItem class, TextField.menu

_name Property

public _name : String

Player version: Flash Player 4

The instance name of the movie clip.

Example
The following example lets you right-click (Windows) or Control-click (Macintosh) a movie clip on the Stage and select Info from the context menu to view information about that instance. Add several movie clips with instance names, and then add the following ActionScript to your AS or FLA file:
var menu_cm:ContextMenu = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem("Info...", getMCInfo));
function getMCInfo(target_mc:MovieClip, obj:Object) {
    trace("You clicked on the movie clip '"+target_mc._name+"'.");
    trace("\t width:"+target_mc._width+", height:"+target_mc._height);
    trace("");
}
for (var i in this) {
    if (typeof (this[i]) == 'movieclip') {
    this[i].menu = menu_cm;
    }
}

See also
Button._name

opaqueBackground Property

public opaqueBackground : Number

Player version: Flash Player 8

The color of the movie clip's opaque (not transparent) background of the color specified by the number (an RGB hexadecimal value). If the value is null or undefined, there is no opaque background. For movie clips in which the cacheAsBitmap property is set to true, setting opaqueBackground can improve rendering performance.

You recognize a greater performance benefit with a movie clip that would have many transparent regions if opaqueBackground were not set.

Note:The opaque background region is not matched in a hitTest() method that has the shapeFlag parameter set to true.

Example
The following example creates a triangle outline and sets the opaqueBackground property to a specific color:
var triangle:MovieClip = this.createEmptyMovieClip("triangle", this.getNextHighestDepth());
triangle._x = triangle._y = 50;
triangle.lineStyle(3, 0xFFCC00);
triangle.lineTo(0, 30);
triangle.lineTo(50, 0);
triangle.lineTo(0, 0);
triangle.endFill();
triangle.opaqueBackground = 0xCCCCCC;

If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in this example.

See also
MovieClip.cacheAsBitmap, MovieClip.hitTest()

_parent Property

public _parent : MovieClip

Player version: Flash Player 5

A reference to the movie clip or object that contains the current movie clip or object. The current object is the object that references the _parent property. Use the _parent property to specify a relative path to movie clips or objects that are above the current movie clip or object.

You can use _parent to move up multiple levels in the display list, as in the following code:

this._parent._parent._alpha = 20;

Example
The following example traces the reference to a movie clip and its parent timeline.The following example logs the reference to a movie clip and its relationship to the main timeline. Create a movie clip with the instance name my_mc, and add it to the main timeline. Add the following ActionScript to your FLA or AS file:
my_mc.onRelease = function() {
    trace("You clicked the movie clip: "+this);
    trace("The parent of "+this._name+" is: "+this._parent);
}

When you click the movie clip, the following information appears in the Output panel:When you click the movie clip, the following information writes to the log file:


      You clicked the movie clip: _level0.my_mc
      The parent of my_mc is: _level0
      

See also
Button._parent, _root, targetPath(), TextField._parent

_quality Property

public _quality : String

Player version: Flash Player 6

Sets or retrieves the rendering quality used for a SWF file. Device fonts are always aliased and therefore are unaffected by the _quality property.

You can set the _quality to the following values:

Value Description Graphic anti-aliasing Bitmap smoothing
"LOW" Low rendering quality. Graphics are not anti-aliased. Bitmaps are not smoothed.
"MEDIUM" Medium rendering quality. This setting is suitable for movies that do not contain text. Graphics are anti-aliased using a 2 x 2 pixel grid. Flash Player 8: Bitmaps are smoothed based on the smoothing parameter used in MovieClip.attachBitmap() and MovieClip.beginBitmapFill() calls.

Flash Player 6 and 7: Bitmaps are not smoothed.

"HIGH" High rendering quality. This setting is the default rendering quality setting that Flash uses. Graphics are anti-aliased using a 4 x 4 pixel grid. Flash Player 8: Bitmaps are smoothed based on the smoothing parameter used in MovieClip.attachBitmap() and MovieClip.beginBitmapFill() calls.

Flash Player 6 and 7: Bitmaps are smoothed if the movie clip is static.

"BEST" Very high rendering quality. Graphics are anti-aliased using a 4 x 4 pixel grid. Flash Player 8: Bitmaps are smoothed based on the smoothing parameter used in MovieClip.attachBitmap() and MovieClip.beginBitmapFill() calls. When the smoothing is set, the result renders with higher quality when the movie clip is scaled down, by using an averaging algorithm. This can slow down rendering, but it allows for applications such as high-quality thumbnails of large images.

Flash Player 6 and 7: Bitmaps are always smoothed.

Note: Although you can specify this property for a MovieClip object, it is also a global property, and you can specify its value simply as _quality.

Example
This example sets the rendering quality of a movie clip named my_mc to LOW:
my_mc._quality = "LOW";

See also
_quality global property

_rotation Property

public _rotation : Number

Player version: Flash Player 4

Specifies the rotation of the movie clip, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range; for example, the statement my_mc._rotation = 450 is the same as my_mc._rotation = 90.

Example
The following example creates a triangle movie clip instance dynamically. When you run the SWF file, click the movie clip to rotate it.
this.createEmptyMovieClip("triangle", this.getNextHighestDepth());

triangle.beginFill(0x0000FF, 100);
triangle.moveTo(100, 100);
triangle.lineTo(100, 150);
triangle.lineTo(150, 100);
triangle.lineTo(100, 100);

triangle.onMouseUp= function() {
    this._rotation += 15;
};

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also
Button._rotation, TextField._rotation

scale9Grid Property

public scale9Grid : Rectangle

Player version: Flash Player 8

The rectangular region that defines the nine scaling regions for the movie clip. If set to null, the entire movie clip scales normally when any scale transformation is applied.

When a scale9Grid property is defined for a movie clip, the movie clip is divided into a grid with nine regions, based on the scale9Grid rectangle, which defines the center region of the grid. The grid has eight other regions:

You can think of the eight regions outside of the center (defined by the rectangle) as being like a picture frame that has special rules applied to it when the movie clip is scaled.

When the scale9Grid property is set and a movie clip is scaled, all text and child movie clips scale normally, regardless of which regions of the scale9 grid they are located in; however, for other types of objects the following rules apply:

If a movie clip is rotated, subsequent scaling is normal (and the scale9Grid property is ignored).

For example, consider the following movie clip and a rectangle that is applied as the movie clip's scale9Grid property:


The movie clip.

The red rectangle shows the scale9Grid.

When the movie clip is scaled or stretched, the objects within the rectangle scale normally, but the objects outside of the rectangle scale according to the scale9Grid rules:

Scaled to 75%:
Scaled to 50%:
Scaled to 25%:
Stretched horizontally 150%:

A common use for setting scale9Grid is to set up a component in which edge lines retain the same width when the component is scaled.

In the Macromedia Flash authoring environment, you can enable guides for 9-slice scaling for a movie clip symbol in a library. This lets you graphically determine the scale9grid for the object. When you set 9-slice scaling for a symbol, the scale9grid property of any instance of that symbol is automatically set. For a symbol that has 9-slice scaling enabled, when you create the SWF file any curve that spans more than one region of the 9-slice scaling grid is divided into separate curves for each region of the grid. For instance, consider a curve in a movie clip symbol for which 9-slice scaling is enabled and the same curve in a movie clip symbol for which 9-slice scaling is not enabled:

Symbol with 9-slice scaling enabled:
Symbol without 9-slice scaling enabled:

When Flash creates the SWF file, the curve in first movie clip illustrated is divided into three curves. This is not the case for the second movie clip, for which the 9-slice scaling is not enabled. Even if you set scale9Grid for the second movie clip to a rectangle that matches the scale9Grid of the first movie clip, when you scale these movie clips the results differ because of the way Flash divides the curves in the first movie clip:

Symbol with 9-slice scaling enabled
scaled to 150%:
Symbol without 9-slice scaling enabled
scaled to 150%:

Example
The following creates a movie clip that contains a 20-pixel line (which forms a border) and a gradient fill. The movie clip scales based on the mouse position, and because of the scale9Grid set for the movie clip, the thickness of the 20-pixel line does not vary when the movie clip scales (although the gradient in the movie clip does scale):
import flash.geom.Rectangle;
import flash.geom.Matrix;

this.createEmptyMovieClip("my_mc", this.getNextHighestDepth());

var grid:Rectangle = new Rectangle(20, 20, 260, 260);
my_mc.scale9Grid = grid ;

my_mc._x = 50;
my_mc._y = 50;

function onMouseMove() 
{
    my_mc._width  = _xmouse;
    my_mc._height = _ymouse;
}

my_mc.lineStyle(20, 0xff3333, 100);
var gradient_matrix:Matrix = new Matrix();
gradient_matrix.createGradientBox(15, 15, Math.PI, 10, 10);
my_mc.beginGradientFill("radial", [0xffff00, 0x0000ff], 
            [100, 100], [0, 0xFF], gradient_matrix, 
            "reflect", "RGB", 0.9);
my_mc.moveTo(0, 0);
my_mc.lineTo(0, 300);
my_mc.lineTo(300, 300);
my_mc.lineTo(300, 0);
my_mc.lineTo(0, 0);
my_mc.endFill();

See also
flash.geom.Rectangle

scrollRect Property

public scrollRect : Object

Player version: Flash Player 8

The scrollRect property allows you to quickly scroll movie clip content and have a window viewing larger content. Text fields and complex content scroll much faster, because pixel level copying is used to scroll data instead of regenerating the entire movie clip from vector data. To see the performance gain, use scrollRect in conjunction with a movie clip that has cacheAsBitmap set to true.

The movie clip is cropped and scrolled with a specific width, height, and scrolling offsets. The scrollRect properties are stored in the movie clip's coordinate space and are scaled just like the overall movie clip. The corner bounds of the cropped window on the scrolling movie clip are the origin of the movie clip (0, 0) and the (scrollWidth, scrollHeight) point. These points are not centered around the origin but use the origin at the upper-left corner. A scrolled movie clip always scrolls in whole pixel increments. If the movie clip is rotated 90 degrees and you scroll it left and right (by setting the scrollRect.x property), it scrolls up and down.

If set to a flash.geom.Rectangle object, the movie clip is cropped to a certain size and scrolled.

Example
The following example sets up a MovieClip hiearchy (by calling the setUpContainer() function) and then sets a new Rectangle as the scrollRect property.
import flash.geom.Rectangle;
var container:MovieClip = setUpContainer();
var window:Rectangle = new Rectangle(0, 0, 100, 40);
container.scrollRect = window;

function setUpContainer():MovieClip {
    var mc:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
    mc._x = 50;
    mc._y = 50;
    mc.opaqueBackground = 0xCCCCCC;
    
    var content:MovieClip = mc.createEmptyMovieClip("content", mc.getNextHighestDepth());
    var colors:Array = [0xFF0000, 0x0000FF];
    var alphas:Array = [100, 100];
    var ratios:Array = [0, 0xFF];
    var matrix:Object = {a:150, b:0, c:0, d:0, e:150, f:0, g:150, h:150, i:1};
    content.beginGradientFill("linear", colors, alphas, ratios, matrix);
    content.lineTo(300, 0);
    content.lineTo(300, 300);
    content.lineTo(0, 300);
    content.lineTo(0, 0);
    content.endFill();
    content._rotation = -90;
    
    mc.onEnterFrame = function() {
        this.content._y += 1;
    }
    
    return mc;
}

The setUpContainer() function performs the following steps:

  1. Create a MovieClip named container
  2. Create a MovieClip named content inside of container
  3. Draw a gradient shape inside of the content MovieClip
  4. Return a reference to the container MovieClip
  5. </