Hello, Im drawn to the screen a scrollView that Im using for the instruction but I cant seem to remove/delete it ive tried using this:
display.remove(scrollView) scrollView = nil;
It doesnt seem to do anything, the same thing happens when I try to remove/delete a textField. Does anyone know why this keeps happening?
Thanks
We need to see more code. I suspect that your scrollView variable is out of scope in the place you are trying to delete it, but will need to see what you’re doing to confirm.
Sorry about that, heres what Im working with, sorry about the code being centered, thanks
helpButton = widget.newButton { left = width - width + 20, top = height - 36, width = 60, height = 100, --defaultFile = "buttonUnpressed.png", --overFile = "buttonPressed.png", label = "Runs Help", onEvent = helpButtonEvent, } function helpButtonEvent(event) phase = event.phase if closing == true then infoScroll:removeSelf() infoScroll = nil end if "began" == phase then cluthaButtonTrigger = false ranfButtonTrigger = false centButtonTrigger = false soButtonTrigger = false mainMenu = false helpButtonTrigger = false print("mainMenu (help button event)=",mainMenu) deleteHelpButton = widget.newButton { left = 0, top = height - height - height/3, width = width, height = height + height, defaultFile = "pink.png", onEvent = closeHelpScreenEvent, } local infoScroll = widget.newScrollView { left = display.contentWidth - 290, top = 0, width = display.contentWidth/1.18, height = display.contentHeight, topPadding = 10, -- 380 bottomPadding = -70, -- -350 horizontalScrollDisabled = true, verticalScrollDisabled = false, listener = scrollListener, }
declare infoScroll at the top of your module
We need to see more code. I suspect that your scrollView variable is out of scope in the place you are trying to delete it, but will need to see what you’re doing to confirm.
Sorry about that, heres what Im working with, sorry about the code being centered, thanks
helpButton = widget.newButton { left = width - width + 20, top = height - 36, width = 60, height = 100, --defaultFile = "buttonUnpressed.png", --overFile = "buttonPressed.png", label = "Runs Help", onEvent = helpButtonEvent, } function helpButtonEvent(event) phase = event.phase if closing == true then infoScroll:removeSelf() infoScroll = nil end if "began" == phase then cluthaButtonTrigger = false ranfButtonTrigger = false centButtonTrigger = false soButtonTrigger = false mainMenu = false helpButtonTrigger = false print("mainMenu (help button event)=",mainMenu) deleteHelpButton = widget.newButton { left = 0, top = height - height - height/3, width = width, height = height + height, defaultFile = "pink.png", onEvent = closeHelpScreenEvent, } local infoScroll = widget.newScrollView { left = display.contentWidth - 290, top = 0, width = display.contentWidth/1.18, height = display.contentHeight, topPadding = 10, -- 380 bottomPadding = -70, -- -350 horizontalScrollDisabled = true, verticalScrollDisabled = false, listener = scrollListener, }
declare infoScroll at the top of your module