How to click close icon to close popup and make buttons active

Hi

I have an image on my app menu and when you click on it, I want it to display like an intestitial ads popup which in my case is a png file I added to the game.

So far when i click on the icon, it displays the png ads image file in addition to the close button at the top right hand.

now my challenge is, how do I close the popup so it returns back to the menu screen and activate the buttons.

local function gamedisplay(screen) -- Remove the old just incase if over\_rect ~= nil then display.remove(over\_rect) over\_rect = nil end if overGroup ~= nil then display.remove(overGroup) overGroup = nil end local function blockTouch(event) return true end over\_rect = display.newRect(screenGroup, \_W\*0.5,\_H\*0.5,\_W,\_H) over\_rect.alpha = 0.01 over\_rect:addEventListener("touch", blockTouch) if utils.mode == 1 then over\_rect:setFillColor(1,0.5) else over\_rect:setFillColor(0,0.5) end transition.to(over\_rect, {time=200, alpha=1}) overGroup = display.newGroup() overGroup.y = \_H screenGroup:insert(overGroup) -- display cookie game ads local button\_displayads = display.newImageRect("images/cookieads.png", 256, 363); button\_displayads.x = \_W\*0.5 button\_displayads.y = \_H\*0.5 -- button\_home.id = "home" -- button\_home:addEventListener("touch", buttonTouched) overGroup:insert(button\_displayads) -- display cookie game ads close button local button\_close = display.newSprite(uiSheet, {frames={uiSheetInfo:getFrameIndex("closex")}}) button\_close.x = button\_displayads.x + (button\_displayads.width/2) - (button\_close.width/2) button\_close.y = button\_displayads.y - (button\_displayads.height/2) + (button\_close.height/2) -- button\_home.id = "home" -- button\_home:addEventListener("touch", buttonTouched) overGroup:insert(button\_close) touchEnabled = false transition.to(overGroup, {time=250, y=0, transition=easing.outQuad, onComplete=function() touchEnabled = true end}) end

Also i plan to add a Download button to it but need help on how to click on the button to take you to the app url page.

Note: closex is the close x button

Thanks

ah never mind, i fixed :slight_smile:

created a closegroup function to revert everything

local function closegamedisplay() touchEnabled = false if over\_rect ~= nil then transition.to(over\_rect, {time=250, alpha=0.01}) end if overGroup ~= nil then transition.to(overGroup, {time=250, y=\_H, transition=easing.outQuad, onComplete=function() touchEnabled = true display.remove(overGroup) overGroup = nil display.remove(over\_rect) over\_rect = nil end}) end end

Then added a trigger in my buttontouch funtion to call it when I click on the closex.

So just need help with when i click on Download button, it should call the app URL while the game is still active or so. Don’t really know how that should work so it does not sit in memory while the player is installing the new game.

ah never mind, i fixed :slight_smile:

created a closegroup function to revert everything

local function closegamedisplay() touchEnabled = false if over\_rect ~= nil then transition.to(over\_rect, {time=250, alpha=0.01}) end if overGroup ~= nil then transition.to(overGroup, {time=250, y=\_H, transition=easing.outQuad, onComplete=function() touchEnabled = true display.remove(overGroup) overGroup = nil display.remove(over\_rect) over\_rect = nil end}) end end

Then added a trigger in my buttontouch funtion to call it when I click on the closex.

So just need help with when i click on Download button, it should call the app URL while the game is still active or so. Don’t really know how that should work so it does not sit in memory while the player is installing the new game.