object.anchorChildren

Type Number
Object GroupObject
Library display.*
Revision 2017.3060
Keywords anchorChildren, anchor
See also Group Programming (guide)

Overview

By default, display groups do not respect anchor points. However, you can achieve anchor behavior on a display group by setting this property to true.

Example

local myGroup = display.newGroup()

local myBox = display.newRect( 100, 100, 80, 80 )
myBox:setFillColor( 1, 0, 0, 0.8 )
myGroup:insert( myBox )

myGroup.x = 50
myGroup.y = 50

--Add a smaller blue box
local blueBox = display.newRect( 50, 50, 50, 50 )
blueBox:setFillColor( 0, 0, 1, 0.8 )
myGroup:insert( blueBox )

myGroup.anchorChildren = true