A movie clip. Analog to the AS3 flash.display.MovieClip
class.
Properties:
Name | Type | Description |
---|---|---|
alpha |
number | The opacity of this movie clip. |
currentFrame |
number | The frame currently being displayed. |
height |
number | The height of this movie clip, in pixels. |
isPlaying |
boolean | Whether this movie clip is currently playing. |
mouseEnabled |
boolean | Whether this movie clip should receive mouse events. |
mouseX |
number | The x position of the mouse relative to this movie clip. |
mouseY |
number | The y position of the mouse relative to this movie clip. |
name |
string | The name of this movie clip. |
onClick |
function | A callback to call when this movie clip is clicked. |
onEnterFrame |
function | A callback to call every frame. |
onMouseDown |
function | A callback to call when the mouse is pressed over this movie clip. |
onMouseMove |
function | A callback to call when the mouse is moved over this movie clip. |
onMouseOut |
function | A callback to call when the mouse is moved out of this movie clip. |
onMouseOver |
function | A callback to call when the mouse is moved over this movie clip. |
onMouseUp |
function | A callback to call when the mouse is released over this movie clip. |
onRollOut |
function | A callback to call when the mouse is moved over this movie clip. |
onRollOver |
function | A callback to call when the mouse is moved out of this movie clip. |
parent |
MovieClip | The movie clip that contains this one. |
root |
MovieClip | The top-level movie clip in the scene. |
rotation |
number | Rotation angle, in degrees clockwise. |
stage |
MovieClip | The top-level movie clip in the scene, same as |
scaleX |
number | Horizontal scale factor. |
scaleY |
number | Vertical scale factor. |
stageWidth |
number | The width of the stage, in pixels. |
stageHeight |
number | The height of the stage, in pixels. |
totalFrames |
number | The number of frames in this movie clip. |
visible |
boolean | Whether this movie clip is visible. |
width |
number | The width of this movie clip, in pixels. |
x |
number | The x position, in pixels. |
y |
number | The y position, in pixels. |
Methods
addEventListener(type, handler)
Registers an event handler for this movie clip.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The event type. |
handler |
function | The event handler to be invoked when the event happens. The handler may take an Event object as an argument. |
- See:
Example
button.addEventListener(MouseEvent.CLICK, function (event) {
alert("The button was clicked!");
});
gotoAndPlay(position)
Moves the playhead to a position and resumes the movie clip playback.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | string | The position to move the playhead to. Can be either a frame number or frame label. |
Example
// Go back to the first frame
gotoAndPlay(1);
gotoAndStop(position)
Moves the playhead to a position and stops the movie clip playback.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | string | The position to move the playhead to. Can be either a frame number or frame label. |
Example
// Go back to the first frame
gotoAndStop(1);
nextFrame()
Moves the playhead to the next frame and stops it.
play()
Resumes the movie clip playback, if it was currently stopped.
prevFrame()
Moves the playhead to the previous frame and stops it.
removeEventListener(type, handler)
Unregisters an event handler for this movie clip.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The event type. |
handler |
function | The event handler. |
Example
button.removeEventListener(MouseEvent.CLICK, clickHandler);
stop()
Stops the movie clip playback, if it was currently playing.