Goal

In this exercise you will learn how to incorporate basic hypertext features into your Director movies.

Background:

Text Cast Members have the unique capability to include hyperlinks, which allow specific words, phrases, or sentences to send messages that can be intercepted and processed by one or more Lingo handlers. You can use hyperlinks to add Internet Browser-like functionality to text in your movies, or otherwise activate features in a Director movie when text is clicked by the user. The steps required to create basic hyperlinks using Text Cast Members are listed below.

Step 1

Create a Text Cast Member, name it, and type some text into it.

Step 2

Highlight one or more of the words you want to convert to a hyperlink and open the Text Inspector Window. The keyboard shortcut for the Text Inspector is COMMAND + T (Macintosh), or CONTROL + T(Windows).
 

Text Cast Member

Step 3

At the bottom of the Text Inspector window is a text entry field with what looks like a "chain link " on the left side. This is where you enter the word or words that become the hyperlink. The word or words you type in this field do not need to match what you highlighted in the Text Cast Member. However, what you type into this field will be the message that is sent when the user clicks the word or words you selected from the Text Cast Member.

Text Inspector Panel

In the example on the right, the words, 'multimedia' and 'computers' were given a hyperlink. The hyperlinks, in this case, were named the same as the words in the Text Cast Member. So, for example, when the user clicks 'multimedia' the message 'multimedia' is sent. When the user clicks 'computers' the message 'computers' is sent. You do not need to name hyperlinks with the same text that appears in the Text Cast Member, but it is often easiest to do so.

Hypertext on the Stage

Once you have assigned hypertext to text in a Text Cast Member you will notice that the hyperlinked text appears blue, with an underline. Like many Internet Browsers, this default color and style scheme visually tells the user that something will happen when they click the hypertext links.
 

Step 4

The next step requires you to attach a behavior to the Text Cast Member that tells Director what you want to have happen when the user clicks a hyperlink. The possibilities are virtually limitless, but several script handler examples are shown below.

-- go to a labeled frame within a movie when a hyperlink is clicked
on hyperlinkClicked me, data
spacer_movie.go(data)
end 

-- go to a URL in a browser. The "data" hyperlink must be a valid URL for this to work
on hyperlinkClicked me, data
spacergotoNetPage(data)
end

-- toggle the position of a sprite when a hyperlink is clicked
on hyperlinkClicked me, data
spacerif data = "show" then
spacerspacer-- move picture onto the screen
spacerspacersprite(4).loc = point(280,180)
spacerelse
spacerspacer-- move picture off screen
spacerspacersprite(4).loc = point(-1000,-1000)
spacerend if
end

The above examples of hyperlinks and more are available in this example movie, which you may download.
 

Exercise:

Create a Director Movie containing a Text Cast Member and at least two hyperlinks. Try attaching different handlers to the Text Cast Member in your movie to get different effects from the hyperlinks.

<     Table of Contents     >