redbutton:addEventListener( ‘touch’, function( e )
if e.phase == “ended” then
print “hi”
Reward.text = tostring(tr[1])
director:changeScene (“screen1”)
end
end)
I’d want the redButton instead to be data[6].image so when I press data[6].image, then it does the changeScene.
Any ideas? [import]uid: 43191 topic_id: 8457 reply_id: 308457[/import]
When you write “local redbutton = whatever” instead write “data[6].image = whatever” and then use data[6].image instead of redbutton. [import]uid: 12108 topic_id: 8457 reply_id: 30299[/import]
[lua]data[6] = {}
data[6].title = “Americano”
data[6].subtitle = “Espresso with hot water”
data[6].image = “coffee6.png”
local data[6].image = display.newImage (“coffee6.png”)
data[6].image.x = 400
data[6].image.y = 100
screenpage:insert(data[6].image)
data[6].image:addEventListener( ‘touch’, function( e )
if e.phase == “ended” then
print “hi”
screenpage:removeSelf()
director:changeScene (“screen1”)[/lua]
it doesnt seem to like the [] symbols [import]uid: 43191 topic_id: 8457 reply_id: 30306[/import]