Find all children in a display group?

I want to move an individual child object in a display group.  When the child object is touched, it will need to know what other children are in its display group.  I know GroupObject.numChildren tells you the number of children in a display group, but I don’t see related APIs I could use.

Perhaps this is a bad use of a display group.  Perhaps it’s more of a one way street, as in once you put objects into a display group, their relative positions are not meant to change.

What I want to do is similar to grouping and ungrouping in drawing programs.  You put shapes into a group, ungroup them if you want to rearrange the shapes, and then put them back in a group.

So, is there a way to find all children in a display group?

Nothing wrong with your usage - it’s a pretty common case to iterate through the children in a group. To access a child, you can simply use groupObject[index], e.g.

for i=group.numChildren, 1, -1 do   local child = group[i]   child.someField = someValue   child.someMethod() end  

The reason for iterating backwards is explained at the bottom of this page: http://developer.coronalabs.com/content/application-programming-guide-graphics-and-drawing

It’s always good to check

if child then

in case there is hole iin table, because object was removed earlier somehow

Nothing wrong with your usage - it’s a pretty common case to iterate through the children in a group. To access a child, you can simply use groupObject[index], e.g.

for i=group.numChildren, 1, -1 do   local child = group[i]   child.someField = someValue   child.someMethod() end  

The reason for iterating backwards is explained at the bottom of this page: http://developer.coronalabs.com/content/application-programming-guide-graphics-and-drawing

It’s always good to check

if child then

in case there is hole iin table, because object was removed earlier somehow