Add href to display text

How do you add a simple weblink in a display.newText object?

Hi Matthew. You can’t add a web link to a portion of text within a display.newText object. But, you can make an entire text object touchable by adding a touch event listener to it, and in your listener, you could cause the touch to open a web page. If you have a lot of text, but you only want a portion of it to act like a web link, then you could make the touchable and non-touchable portions as two separate objects and position them so they flow together. Alternatively, you could make just one text objectwoth all the text, add a touch listener, but in your listener, only open the web link if the x,y coordinates of the touch fall within the portion of the text that you actually want to be touchable.

So basically, I am not missing something :wink: That is how I set it up but was hoping to do something in-line. I appreciate the help.

Hi Matthew. You can’t add a web link to a portion of text within a display.newText object. But, you can make an entire text object touchable by adding a touch event listener to it, and in your listener, you could cause the touch to open a web page. If you have a lot of text, but you only want a portion of it to act like a web link, then you could make the touchable and non-touchable portions as two separate objects and position them so they flow together. Alternatively, you could make just one text objectwoth all the text, add a touch listener, but in your listener, only open the web link if the x,y coordinates of the touch fall within the portion of the text that you actually want to be touchable.

So basically, I am not missing something :wink: That is how I set it up but was hoping to do something in-line. I appreciate the help.