Shape

A Shape object draws vectors to the canvas.

new Shape()

Creates Shape object

Methods

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.

beginFill(color, alpha)

Begings to fill.

Parameters:
Name Type Description
color int A color of the fill
alpha alpha An alpha of the fill

beginStroke(thickness, color, alpha)

Begins to stroke.

Parameters:
Name Type Description
thickness Number A thickness of the stroke
color int A color of the stroke
alpha Number An alpha of the stroke

dispatchEvent(Event)

Dispatches an event to the event flow.

Parameters:
Name Type Description
Event arc.Event object

drawCircle(x, y, radius)

Draws a circle.

Parameters:
Name Type Description
x Number A horizontal position of the center of the circle
y Number A vartical position of the center of the circle
radius Number A radius of the circle

drawRect(x, y, width, height)

Draws a rect.

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

endFill()

Ends to fill.

endStroke()

Ends to stroke

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

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

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

lineTo(x, y)

Changes the current position with drawing the line from the previous position.

Parameters:
Name Type Description
x Number A new horizontal position
y Number A new vartical position

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

moveTo(x, y)

Changes the starting position to draw the line.

Parameters:
Name Type Description
x Number A new horizontal position
y Number A new vartical position

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

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