Local event listener/ global

Hey all,

I have some icons that need to detect a ‘touch’ so:

local layer = layer_hud:spriteWithUniqueName(“ladder”)

layer.touch = touched

layer:addEventListener( “touch”, layer)

But I also need a global (runtime) listener to check for touches over the screen

Once this is activated the local icons don’t seem to get their events .

Tried returning false at the end of the runtime listener (assuming it would allow it to propogate to them) ; but no joy.

As the runtime listener just detects the screen I’m guessing it is having priority over the local listeners ; is there a fix/method to give my icons priority instead and receive the touch event?

thanks 

You could try creating a newRect the size of the screen and set the alpha so it’s not seen the add the touch event to it instead of using runtime

Hi,

Yes I could do that. But I really would prefer local objects having their own collision handler and also general (touch anywhere on screen) runtime handler aswell.

It does seem that a runtime touch/tap completely mitigates any local event touch/tap handler.

Be nice if Corona could confirm/deny this.

Really I want an object touch/tap that if not dealt with goes to the runtime global touch/tap - that would be the best…

Cheers

Hi @m.hula,

I guess I’d have to see the code, but any touch that is not “handled” by a local object listener (with “return true” at the end of its listener function, not “return false”), should propagate down to the Runtime global level, where you can handle it there. But I assume you’ve tried this already?

Brent

You could try creating a newRect the size of the screen and set the alpha so it’s not seen the add the touch event to it instead of using runtime

Hi,

Yes I could do that. But I really would prefer local objects having their own collision handler and also general (touch anywhere on screen) runtime handler aswell.

It does seem that a runtime touch/tap completely mitigates any local event touch/tap handler.

Be nice if Corona could confirm/deny this.

Really I want an object touch/tap that if not dealt with goes to the runtime global touch/tap - that would be the best…

Cheers

Hi @m.hula,

I guess I’d have to see the code, but any touch that is not “handled” by a local object listener (with “return true” at the end of its listener function, not “return false”), should propagate down to the Runtime global level, where you can handle it there. But I assume you’ve tried this already?

Brent