Layered Images and Events

I’m a noob, and I’m a web designer/front end developer so I’m going about learning Lua and Corona from that perspective.

I have looked through the docs but I either can’t find what I’m looking for, or I can’t find it in a way that I can comprehend.

I have a couple of images on the screen and I have two events. Is it possible to layer images with what in html/css we’d use as z-index? So image B comes after image A in the document structure, so it’s “on top of” image A. And if you touch image B, only image B is touched, even it it’s overtop/layered over image A.

I’m guessing I will have to go about it by dealing with the events rather than the images themselves? Basically, I don’t want event B to be available unless event A has happened.

Thanks in advance for helping me learn - please excuse my noobness!

Here’s the code I’m working again. http://pastie.org/2960004 [import]uid: 101670 topic_id: 18555 reply_id: 318555[/import]

if you want for image to respond only to its event, and do not call event for image in back of it, just make your touch functions like this:
[lua]local function touch(event)
if event.phase == “ended” then

print(“i am touched”)
end

return true – you want to add this line
end[/lua] [import]uid: 16142 topic_id: 18555 reply_id: 71270[/import]

Thanks darkconsoles for your quick reply.

Actual both images have events, it’s just that the second event which is connected to the “bottom” image, needs to not happen unless and until that first image and event has happened.

I played around with the code you gave me and it didn’t do anything. Maybe I need to reiterate that I am a COMPLETE noob! [import]uid: 101670 topic_id: 18555 reply_id: 71290[/import]

you can either use
[lua]return true[/lua]
which darkconsoles pointed out, to prevent the touch event from “falling through” to the objects underneath, or you can setFocus to the object in question, so all touches are sent to the focused object only, and return focus when the touch ends. [import]uid: 5317 topic_id: 18555 reply_id: 71364[/import]