tap event of current image object

Hi,
I am beginner in mobile apps. And now developing some color apps for child(user).
I have different color images object and when user select a color and click or tap on any image object then that color of image will appear. But my problem is that some time two image object(with same color) appear simultaneous when user click on single object or when user click on first object then the color object appear on next object not in click object.
Any idea then give some example?

Thanks. [import]uid: 75428 topic_id: 12718 reply_id: 312718[/import]

@sabir,
if you mean that you have two overlapping objects and the moment you click on one, the one under also gets the click, then you need to have “return true” in the event handler to avoid/stop bubbling.

If it is some other thing, share your code that does the same for someone to help you debug the same.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 12718 reply_id: 46596[/import]

Hi,
I did the return statement but its not working.
I think when I click on an image then (the nearest images which is touch the click image)the two images fill.
That’s why I am facing problem.
I think the image transparent area is overlap over another image.
If you have idea then suggest me?

Thanks. [import]uid: 75428 topic_id: 12718 reply_id: 47263[/import]

see the effect by removing

return true and without

[lua]local img1 = display.newRect(0,0,100,100)
local img2 = display.newRect(50,0,100,100)
img2:setFillColor(0,255,0,100)

local function img1F(e)
print(“this will not print”)
end

local function img2F(e)
print(“this will print”)
return true
end
img1:addEventListener(“tap”,img1F)
img2:addEventListener(“tap”,img2F)[/lua] [import]uid: 12482 topic_id: 12718 reply_id: 47290[/import]

Hi,
This is not the exact code which I’m looking for.
I have nine object with same event and ten color with same event
when user click any one color and after that click image object part then that color of image will appear at that place(where user clicked).

Thanks. [import]uid: 75428 topic_id: 12718 reply_id: 47292[/import]