MovieClip

A display object works like the ActionScript3.0's MovieClip. It controls the animations of its children with a key frame animation definition object that is specified when adding the child.

new MovieClip(fps, shouldLoop, shouldAutoPlay)

Parameters:
Name Type Description
fps Number FPS
shouldLoop Boolean If true the animation will be looped
shouldAutoPlay Boolean If true the animation plays when it is shown, false the animation plays when the play method is called
Example
 var mc = new arc.display.MovieClip();
mc.addChild(this._yellowImg, {
	1 : {visible:true},
	3 : {visible:false}
});
mc.addChild(this._orangeImg, {
	1 : {scaleX:0.5, scaleY:0.5, transition:arc.anim.Transition.SINE_OUT},
	5 : {scaleX:3, scaleY:3}
});

Methods

addChild(targ, keyFrameObj)

Adds the display object to the display list with a key frame object.

Parameters:
Name Type Description
targ DisplayObject A display object that is going to be added to the display list
keyFrameObj Object An object that takes a frame index as a key and a group of properties as a value

addChildAt(targ, index, keyFrameObj)

Adds the display object to the display list at the specified depth with a key frame object.

Parameters:
Name Type Description
targ DisplayObject A display object that is going to be added to the display list
index int A depth
keyFrameObj Object An object that takes a frame index as a key and a group of properties as a value

addEventListener(type, callback)

Registers an event listener object to EventDispatcher object so that the listener receives the notification.

Parameters:
Name Type Description
type String The type of event.
callback Function The listener function.

clearMask()

Deletes the clipping mask.

contains(targ) → {Boolean}

Determines whether the display object is a child of the display object container.

Parameters:
Name Type Description
targ DisplayObject A display object to test
Returns:
Boolean true if the display object is a child of the display object container

dispatchEvent(Event)

Dispatches an event to the event flow.

Parameters:
Name Type Description
Event arc.Event object

getAlignX() → {Number}

Returns a horizontal position from the origin.

Returns:
Number A horizontal position from the origin

getAlignY() → {Number}

Returns a vartical position from the origin.

Returns:
Number A vartical position from the origin

getAlpha() → {Number}

Gets the alpha.

Returns:
Number An alpha

getHeight() → {Number}

Returns the height.

Returns:
Number A height

getParent() → {DisplayObject}

Returns the parent of this display object.

Returns:
DisplayObject The parent

getRotation() → {Number}

Returns the rotation.

Returns:
Number A rotation in degree

getScaleX() → {Number}

Returns the horizontal scale.

Returns:
Number A horizontal scale

getScaleY() → {Number}

Returns the vartical scale.

Returns:
Number A vartical scale

getStage()

Returns a Stage object.

getVisible() → {Boolean}

Returns the visibility.

Returns:
Boolean A visibility

getWidth() → {Number}

Returns the width.

Returns:
Number A width

getX() → {Number}

Returns the horizontal position.

Returns:
Number A horizontal position

getY() → {Number}

Returns the vartical position.

Returns:
Number A vartical position

globalToLocal(x, y) → {Array}

Converts global positions to local positions.

Parameters:
Name Type Description
x Number A global horizontal position
y Number A global vartical position
Returns:
Array An array that includes local positions of x and y in [x, y].

gotoAndPlay(index)

Plays the animation from the specified frame.

Parameters:
Name Type Description
index int A frame which the animation starts from

gotoAndStop(index)

Stops at the specified frame.

Parameters:
Name Type Description
index int A frame which the animation stops at

localToGlobal(x, y) → {Array}

Converts local positions to global positions.

Parameters:
Name Type Description
x Number A local horizontal position
y Number A local vartical position
Returns:
Array An array that includes global positions of x and y in [x, y].

play(shouldLoop)

Playes the animation.

Parameters:
Name Type Description
shouldLoop Boolean If true the animation will be looped

removeEventListener(type, callback)

Removes a listener from the EventDispatcher object.

Parameters:
Name Type Description
type String The type of event.
callback Function The listener function.

setAlpha(An)

Sets an alpha.

Parameters:
Name Type Description
An Number alpha

setChildIndex(child, index)

Changes a depth of the display object.

Parameters:
Name Type Description
child DisplayObject A display object which is going to be changed its depth.
index Number A new depth

setMask(x, y, width, height)

Sets a clipping mask.

Parameters:
Name Type Description
x Number A horizontal position of the clipping mask
y Number A vartical position of the clipping mask
width Number A width of the clipping mask
height Number A height of the clipping mask

setRotation(A)

Sets a rotation.

Parameters:
Name Type Description
A Number rotation in degree

setVisible(A)

Sets a visibility.

Parameters:
Name Type Description
A Boolean visibility

setX(x)

Sets a horizontal position.

Parameters:
Name Type Description
x Number A horizontal position

setY(y)

Sets a vartical position.

Parameters:
Name Type Description
y Number A vartical position

stop()

Stops the animation.