Hi guys.
I contact you cause i want change a text with a button. I tried but the code doesn’t run.
Here the code
local number = math.random (10)
local text = display.newText(number, 420, 25, “Arial”, 24)
text.x = 340
text.y = 30
local button = display.newImage(“play1.png”)
button.x = 300
button.y =50
button.xScale = 0.1
button.yScale = 0.1
local function changeText(event)
if event.phase==“ended” then
number = math.random (10)
button:removeEventListener( “touch”, changeText )
end
end
button:addEventListener( “touch”, changeText )
I tried to change position (to test the code) and the code run,