Hi
I am trying to build a very simple app emulating flash cards for memorizing.
I would like to have the app listen for and react to a touch to a particular bit of text, i.e., the choices in a multiple choice question.
I display the answer choices on screen like this
local textObject = display.newText("a. " … questions[i].right, 120, 200, native.systemFontBold, 15 )
local textObject = display.newText("b. " … questions[i].wrong1, 120, 240, native.systemFontBold, 15 )
local textObject = display.newText("c. " … questions[i].wrong2, 120, 280, native.systemFontBold, 15 )
I added a function and event listener thus:
function touchScreen(event)
if event.phase == “began” then
local textObject = display.newText(“you touched the screen!”, 220, 380, native.systemFontBold, 15 )
end
end
Runtime:addEventListener(“touch”, touchScreen)
but this only ‘hears’ touches to the screen anywhere on the screen. I’m not sure how to to proceed from here. Have read several tutorials but am stuck. Any help very appreciated!
