object:remove()

Type Function
Object GroupObject
Library display.*
Return value DisplayObject
Revision Current Public Release (2017.3068)
Keywords remove, remove child
See also object:removeSelf()
display.remove()
Group Programming (guide)

Overview

Remove an object from a group by either an index number or a reference to the object.

Gotchas

Syntax

object:remove( indexOrChild )
indexOrChild (required)

Number or DisplayObject. Removes the display object specified from the group, shifting down other elements as needed. The argument is either the index position of the child within group (number) or the child display object itself.

Example

-- Remove the second object from the group
display.getCurrentStage():remove( 2 )