I’m hoping someone can help me with a couple of questions I have.
- I have an image that I put a listener on like this:
local ball = display.newImage("images/ball.png")
ball:addEventListener( "touch" , removeMe )
I later remove the ball object in a listener, then I remove that listener
ball:removeSelf()
.....
wood:removeEventListener( "touch" , removeMe )
When I try to remove that listener after the object was removed I get an error
“attempt to call method ‘removeSelf’ (a nil value)”
How do I remove the listener? Just to note I am using the director class.
- I am getting the same error:
attempt to call method ‘removeSelf’ (a nil value)
in the following function on the line that is removing the item “chesttop”. I can’t figure out why because it works just as I intend in the simulator.
local closechest = function()
chesttop:removeSelf() --error on this line
basketball:removeSelf()
audio.play( chestSound )
physics.pause()
if type(SQL:loadVar("highestfinished")) \>= levelNum then
SQL:saveVar( "highestfinished", 1 )
end
end
Hopefully someone can shed some light on this for me? I appreciate everyone’s help as always.
[import]uid: 31262 topic_id: 8366 reply_id: 308366[/import]
I’ll give it a try and see if it makes a difference. [import]uid: 31262 topic_id: 8366 reply_id: 30150[/import]