Lingo Dictionary > G-K > on hyperlinkClicked |  |

on hyperlinkClicked

Syntax

    on hyperlinkClicked me, data, range
    	statement(s)
    end

Description

System message and event handler; used to determine when a hyperlink is actually clicked.

This event handler has the following parameters:

| `me`—Used in a behavior to identify the sprite instance
| `data`—The hyperlink data itself; the string entered in the Text Inspector when editing the text cast member
| `range`—The character range of the hyperlink in the text (It's possible to get the text of the range itself by using the syntax member Ref.char[range[1]..range[2]]

This handler should be attached to a sprite as a behavior script. Avoid placing this handler in a cast member script.

Example

This behavior shows a link examining the hyperlink that was clicked, jump to a URL if needed, then output the text of the link itself to the message window:

    property spriteNum
    on hyperlinkClicked me, data, range
    	if data starts "http://" then
    		goToNetPage(data)
    	end if
    	currentMember = sprite(spriteNum).member
    	anchorString = currentMember.char[range[1]..range[2]]
    	put "The hyperlink on"&&anchorString&&"was just clicked."
    end