Hi,
I’m studing the “Groups” in Corona but I have a trouble:
when I try to repeat two times my program Corona goes in error with this window:
File: …Lab7/iPhone/Corona SDK/Sviluppo/Test/Groups/main.lua
Line: 19
ERROR: Attempt to remove an object that’s already been removed from the stage or whose parent/ancestor group has already been removed.
Can you help me?
This is my program:
cubo3= display.newRect(100, 500, 180, 200)
function build()
cubo= display.newRect(30, 100, 180, 200)
cubo:setFillColor(00, 140, 250)
cubo2= display.newRect(100, 250, 200, 120)
cubo2:setFillColor(100, 140, 00)
testo=display.newText(“TEXT”,40,250,native.systemFont, 22)
livello1=display.newGroup() – Generate new group
livello1:insert(cubo) – add elements to group
livello1:insert(cubo2)
livello1:insert(testo)
testo:toFront() – text to front
livello1:addEventListener(“touch”, erase)
end
function erase() – erase the group
print(“Group”)
livello1:removeSelf()
end
build() – launch the build function
cubo3:addEventListener(“touch”, build) – inf cubo3 is pressed launch function build to restart
Thank’s.
Andrea