I’m used to HTML where, to make a text or an image a link you simply put it in an anchor tag (such ).
How can I do the same thing in the Lua language?
Thanks,
TIm [import]uid: 223752 topic_id: 35717 reply_id: 335717[/import]
I’m used to HTML where, to make a text or an image a link you simply put it in an anchor tag (such ).
How can I do the same thing in the Lua language?
Thanks,
TIm [import]uid: 223752 topic_id: 35717 reply_id: 335717[/import]
You can use a image:
[lua]
–Image
local button = display.newImage( “button.png” )
function button:tap( event )
–type your code here
end
button:addEventListener( “tap”, button )
[/lua]
A Text:
[lua]
–Text
local text = display.newText( “Link”, 30, 30, nil, 40 ) --text, x, y, font, font size
function text:tap( event )
–type your code here
end
text:addEventListener( “tap”, text )
[/lua]
or a widget button: http://docs.coronalabs.com/api/library/widget/newButton.html [import]uid: 194543 topic_id: 35717 reply_id: 142025[/import]
You would then use system.openURL(url_to_open) inside those tap functions. [import]uid: 199310 topic_id: 35717 reply_id: 142032[/import]
You can use a image:
[lua]
–Image
local button = display.newImage( “button.png” )
function button:tap( event )
–type your code here
end
button:addEventListener( “tap”, button )
[/lua]
A Text:
[lua]
–Text
local text = display.newText( “Link”, 30, 30, nil, 40 ) --text, x, y, font, font size
function text:tap( event )
–type your code here
end
text:addEventListener( “tap”, text )
[/lua]
or a widget button: http://docs.coronalabs.com/api/library/widget/newButton.html [import]uid: 194543 topic_id: 35717 reply_id: 142025[/import]
You would then use system.openURL(url_to_open) inside those tap functions. [import]uid: 199310 topic_id: 35717 reply_id: 142032[/import]