When the user clicks an arrow icon in my app, a sub menu appears (see code below only with the background to facilitate the understanding). If user clicks the arrow again, the menu must be removed (I don’t want to make is invisible to avoid memory usage). How can I do that?
local arrow = “close”
local function onFullMenu()
if (arrow==“close”) then
–Opens menu
local back = display.newRect(0,0,100,100)
back:setFillColor(10,101,10)
menu:insert(back)
arrow = “open”
else
arrow=“close”
menu:remove(back) --Here i want to remove the “back” from the screen but it is not working
end if
local menu = display.newGroup()
arrowDownButton = ui.newButton{
default = “butArrowDown.png”,
over = “butArrowDownRoll.png”,
onPress = onFullMenu
}
menu:insert(arrowDownButton) [import]uid: 4883 topic_id: 929 reply_id: 300929[/import]