GroupObject

Parent DisplayObject
Library display.*
Revision Release 2024.3703
Keywords group, display group, groups
See also display.newGroup()
Group Programming (guide)

Overview

Group objects are a special type of display object. You can add other display objects as children of a group object. You can also remove them. Even if an object is not visible, it remains in the group object until explicitly removed. Thus, to minimize memory consumption, you should explicitly remove any object that will no longer be used.

All objects are implicitly added to the current stage, which itself is a kind of group object.

Corona does not have layers or levels but groups can be used to simulate the functionally. Objects added to groups can be moved and transposed as a group by controlling the group object.

Child objects can also be accessed by array index, for example:

group[4]:removeSelf()

See the Group Programming guide for more information about group objects.

Gotchas

Using groups with the physics engine has some limitations — see the Physics Notes/Limitations guide.

Properties

(Inherits properties from DisplayObject)

object.anchorChildren

object.numChildren

Methods

(Inherits methods from DisplayObject)

object:insert()

object:remove()