I was wondering if someone can help explain the code block below. I found it in the App Programming Guide (http://developer.anscamobile.com/content/app-programming-guide).
I understand assigning an event listener to the [lua]rect[/lua] object and then assigning a variable to the “tapped” [lua]rect[/lua] within the function. But I’m a little confused about assigning variables to the parent and how this is allowing the object to be garbage collected properly.
[lua]local rect =display.newRect(0,0,10,10)
rect:setFillColor(255,255,255)
local function removeOnTap(event)
local t = event.target
local parent = t.parent
parent:remove( t )
return true
end
rect:addEventListener(“tap”, removeOnTap )[/lua] [import]uid: 29663 topic_id: 5739 reply_id: 305739[/import]