addd event listener to nothing

Is there a way to cause a function to happen when you tap the screen, not any particular object? I realize I can do a runtime, but then if I move it does the function for each frame.

Much appreciated,
J.K. [import]uid: 66117 topic_id: 17428 reply_id: 317428[/import]

You could add an event listener to the background? [import]uid: 5717 topic_id: 17428 reply_id: 66025[/import]

Runtime:addEventListener( “touch”, otherTouch )

This will cause the function otherTouch() to get called whenever you tap the screen if no other object intercepts the event.

I learned this from one of the multitouch example included with the coronaSDK. [import]uid: 67839 topic_id: 17428 reply_id: 66110[/import]

When you’re finished with the event, don’t forget to call Runtime:removeEventListener( “touch”, otherTouch ) because unlike touch events that are added to specific objects, Runtime event listeners never get automatically removed. [import]uid: 52430 topic_id: 17428 reply_id: 66134[/import]

You could also add a “tap” listener to your background image - not suitable if you have objects on top returning true but otherwise a reasonable solution :slight_smile:

Peach [import]uid: 52491 topic_id: 17428 reply_id: 66194[/import]