I’ve been trying to understand event handling but I have not been able to use the ‘setfocus’ command at all. i have two overlapping image objects. mmScreen is an image which is the whole iphone screen and the playBtn image is 200x60. The playBtn image is on top.
My issue is that I do not want the mmScreen listener to be invoked when i tap the ‘playBtn’. But it does… (on console, i see the print statement ‘touch printed out’) I’ve tried various combinations of setfocus method and it doesn’t do a thing. (its commented out in my code below)
Here is my code snippet:
[lua]menuScreenGroup:insert (mmScreen)
menuScreenGroup:insert (playBtn)
playBtn:addEventListener(“tap”, loadGame)
mmScreen:addEventListener(“touch”, testTouch)
end
function testTouch (event)
if event.target == “began” then
Num = Num + 1
print ("touched "… Num)
end
end
function loadGame(event)
if event.target.name == “playbutton” then
print (“tapped”)
–display.getCurrentStage():setFocus( self ) tried this and it didn’t work
transition.to(menuScreenGroup, {time = 300, alpha = 0, onComplete = addGamescreen})
playBtn:removeEventListener(“tap”, loadGame)
return true
end
end [lua]It is always something simple, so any help is appreciated. [import]uid: 179798 topic_id: 32833 reply_id: 332833[/import]
[import]uid: 179798 topic_id: 32833 reply_id: 130831[/import]