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.

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:

local function touch(event)
 if event.phase == "ended" then
  print("i am touched")
return true -- you want to add this line

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!

you can either use

return true
views:906 update:2011/12/30 9:10:41
corona forums © 2003-2011