I created a local group and insert objects in it on the screen as a rectangle and then use myGroup:removeSelf() and myGroup = nil. Automatically memory for the rectangle and all other elements will be emptied too? (next code)
cenarioGrupo = display.newGroup()
local chao = display.newRect( display.contentWidth*0.5, display.contentHeight*0.95, display.contentWidth, display.contentHeight*0.1 )[
cenarioGrupo:insert(chao)
--Then..
cenarioGrupo:removeSelf(); cenarioGrupo = nil;
and other question. How can I use the cenarioGrupo in createScene function, and it is only created in function criarCenario? Returning it? Creating it overall?
local function criarCenario()
cenarioGrupo = display.newGroup()
local chao = display.newRect( display.contentWidth*0.5, display.contentHeight*0.95, display.contentWidth, display.contentHeight*0.1 )
chao:setFillColor(1,1,1)
cenarioGrupo:insert(chao)
end
function scene:createScene( event )
local sceneGroup = self.view
criarCenario()
end