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.
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
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.
You could add an event listener to the background?
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.
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.
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 :)
Peach