Hi, guys!
I am quite new to Corona and i have some problem.
I have some image. And i want to spawn some text, when i touch the image. And if I touch anywhere else the text would disappear.
the first code i wrote was
[lua]local img = display.newCircle(100, 100, 25)
img.id = “circle”
local text = display.newText("", 200, 200, native.systemFont, 72)
img:setFillColor(255, 0, 0)
text:setTextColor(255, 0, 0)
local function test (event)
if event.target.id == “circle” then
text.text = “SDASDASDS”
else
text.text = “”
end
end
Runtime:addEventListener(“tap”, test)[/lua]
But then I saw, that if I add eventlistener to Runtime - I get NIL as event.target always. Is there a way to simply solve this problem? How to get the object, that was touched?
Thanks! [import]uid: 41345 topic_id: 8118 reply_id: 308118[/import]