Hello
I have a button in my app where I want to give the user some feedback, when pressed. I did this with making a small rect-box behind the button, and when the user push the button it gives a little flash.
the box is set to Visible = false and gets set to true when the user push the button.
I use performWithDelay to set it back to false and hide the box again after some time.
This works… how ever I am wondering if this is the “correct” way. In the corona simulator output, I print the value of the timer. It shows how long time since the last time the user pushed the buttom. I don’t need that and it is a waste of resources for the phone keeping track of that.
Any tips for doing a delayed task in Lua/Corona?
You are velcome to see my code.
local function myTapListener( event ) -- Code executed when the button is tapped local r = math.random(1,126) textBox.text = textString[r] print(r) rect.isVisible = true local function manageTime( event ) rect.isVisible = false print( event.time ) end timer.performWithDelay( 50, manageTime) return true end