Remove the child at the specified index in the children array.

Syntax removeChildAt(index [, redraw])

Return Type displayObject


Remove the child at the specified index in the children array. This will remove the child from the canvas as well.


index : Number
The index of the child that will be removed.
redraw : Boolean (since version 2.6.0)
If set to false, the canvas will not be redrawn right after the object is removed from the canvas. Can be used if you are removing lots of objects at the same time, but only want to redraw once when it's done.

Return Value

displayObject. Returns the display object itself.


Example 1

We create a new core instance, a rectangle and a square. Then we add the rectangle to the canvas and add the square as a child to the rectangle. Finally we add an event handler that removes square when the rectangle is clicked.

View Example
var canvas = oCanvas.create({
	canvas: "#canvas",
	background: "#ccc"

var rectangle = canvas.display.rectangle({
	x: 77,
	y: 270,
	width: 200,
	height: 100,
	fill: "#000"

var square = canvas.display.rectangle({
	x: 10,
	y: 10,
	width: 50,
	height: 50,
	fill: "#0ff"



rectangle.bind("click tap", function () {