Hi All,
I want to enable clicking on some texts and have them change color once they're touched. I also want to keep the text display in an array. Can you see what's wrong with this? I'm having a hard time figuring why this will not work. When I'm not using the array, I'm able to add the event and trigger the color change. I'm also open to other ideas.
local wordsText = {}
for i = 1, 3, 1 do
wordsText[i] = display.newText( "hi", 0, i * 100, "Helvetica", 40 )
wordsText[i]:setTextColor(255, 0, 255)
wordsText[i]:addEventListener("touch", changeColor)
end
This is the stack trace that I'm getting when I run the above code:
Runtime error: assertion failed!
stack traceback:
[C]: ?
[C]: in function 'assert'
?: in function 'getOrCreateTable'
?: in function 'addEventListener'
Thanks in advance!!
Jen