I have a module which creates a popup window. It has a close button which calls display.remove on the display group. But for some reason, the display group is still there… Code is posted below. Can’t figure out what’s wrong…
local M = {} local dg function M.create() dg = display.newGroup() dg.x, dg.y = display.contentCenterX, display.contentCenterY local function closePopup(event) if(event.phase == "began") then elseif(event.phase == "ended") then print("Close popup!") display.remove(dg) dg = nil end return true end local backdrop = display.newImageRect(dg, "sprites/you\_won\_backdrop.png", 700,1000) local close\_button = display.newImageRect(dg, "sprites/red\_arrow.png", 25,25) close\_button:addEventListener("touch", closePopup) end return M