Search code examples
storyboardcoronasdkcorona-storyboard

Using Displaygroups with Corona sdk storyboard


I´m trying to use my own displaygroup in storyboard with no luck. I bet there is an easy answer?!

local group = self.view --The storyboardGroup

local myGroup = display.newGroup()

for i = 0, 10 do
myObject = display.newImageRect( "mypicture.png", 20, 20 )
myObject.myName = "myObject " .. i
myGroup:insert(myObject)
end

group:insert( myGroup )

And now if I do: print(#myGroup) = 0 or print(#group[myGroup]) = ERROR

How do I access myGroup???


Solution

  • To retrieve the number of elements in a display group you should use

    myGroup.numChildren
    

    http://docs.coronalabs.com/api/type/GroupObject/numChildren.html