Buttons don't removeSelf iOS

I’ve been trying for 2 nights to get these 2 buttons to disappear after clicking one of them. They behave as expected in the Mac simulator, but not when I test on an iPhone 4 running iOS 4.3.5. For some reason they get sent to a new depth, but they still work. It took me a while to figure it out because they actually get sent behind the background image, so they’re hidden.

I tried just adding my own touch event to them to make sure it wasn’t a problem with buttons. Same prob.

 obj.playButton = display.newImageRect( "\_images/genericButton.png", 100, 40 )  
 function obj.playButton:touch( event )  
 if event.phase == "ended" then  
 timer.performWithDelay(200, function() showGameScreen() end, 1)   
 end  
 end  
 obj.playButton:addEventListener( "touch", obj.playButton )  

the ‘showGameScreen()’ function removes all of the existing stuff from the stage by calling the following:

 function obj:remove()  
 print( "removing" )  
 obj.playButton:removeSelf()  
 obj.playButton = nil  
 obj.leaderButton:removeSelf()  
 obj.leaderButton = nil  
 obj:removeSelf()  
 end  

So you can see I’m tracing to make sure the remove function gets called. What gives? Anybody? [import]uid: 71272 topic_id: 13656 reply_id: 313656[/import]

That’s a little bizarre, although I’m guessing there’s more to the function than that… Have you been getting any errors?

Have you considered just calling a standard removeSelf() on tap, if you want them to remove as soon as they are pressed anyway? It might save you some headaches. [import]uid: 52491 topic_id: 13656 reply_id: 50154[/import]