I added @vlads’ code to my demo project and it doesn’t work.
My demo project consists of two files:
main.lua
display.setStatusBar( display.HiddenStatusBar ) local composer = require( "composer" ) composer.gotoScene( "menu" )
menu.lua
local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view local function change( event ) event.target:setFillColor( 1, 0, 0 ) event.target.text.text = "Tapped" end local rect = display.newRect( 160, 240, 320, 480 ) rect.text = display.newText( "Not tapped", 160, 240, system.defaultFont, 40 ) rect.text:setFillColor(0) timer.performWithDelay(1, function() rect:addEventListener( "touch", change ) end) sceneGroup:insert( rect ) sceneGroup:insert( rect.text ) end scene:addEventListener( "create", scene ) return scene
As most probably see straight away, when the app loads, it just jumps to menu.lua and create a white rect and a black text object reading “Not tapped”. Once the white rect is tapped, i.e. the screen is touched, the rect turns red and the text object reads “Tapped”.
The touch event listener is added in menu.lua inside that delay function, but still, if you tap the screen when the splash screen is up, the tap goes through.