Issue: how to use hyperlinkstyles for textmembers | go straight to sample |
this is something which is not really well documented. here are the steps
1) you have to define some text as a hyperlink the easiest way to do it is to simply hilite the word or string you want to be a hyperlink and enter a value in the link field (the one with the chain icon) in the textinspector. this value can be anything. it can be a URL to which you want to link, it can be something else you want to pass on when the hyperlink is clicked. in any case you define later what to do with it. if you want to dynamically create hyperlinks with lingo you can use hyperlink to assign a value and the hyperlinkstyles to a textstring. there is no sample of this in the lingo dictionary. here is how you do it: textstring.hyperlink = "value" if i want e.g. the 3rd word of member "text" to have the hypertextvalue "hi there" i would write: member("text").word[3].hyperlink = "hi there" important: you get rid of existing hyperlinks by setting it's value to "" or EMPTY, like member("text").word[3].hyperlink = ""
2) you have to define what to do when the hyperlink is clicked i get this question quite regularly. other than in HTML when you click on a hyperlink in Director it does not mean automatically that you want to go to another webpage. you simply pass on information to a handler called on hyperlinkClicked. you have to define this handler yourself in a moviescript (if you don't define it you will get a "handler not defined" error). if you want to link to a webpage you would use: on hyperlinkClicked me,
data "data" is always
the value that is associated with the specific link. if you want to use the value for alertmessages you could use: on hyperlinkClicked me,
data or you can use combinations like: on hyperlinkClicked me,
data etc. |
|
below you find a sample to play with. select a word which shall become a hyperlink and enter a message that will be alerted when the hyperlink is clicked. you can get rid of all hyperlinks when you assign an empty message to the word which happens to be the current hyperlink. |