6. Working with links
A link in Sophie is an action that is triggered when the book is read by the reader. A link can be triggered when the reader turns to a particular page; it can also be triggered when the reader clicks on a graphic. When this happens, different other things can happen: the book might turn to another page, or a frame might be hidden and shown.
In Sophie, links are possible on the page, frames, and in text. Page, frame, and text links function similarly: first we'll look at how links on frames work, then describe how links on pages or in text differ.
Links on frames
Click on a frame's link halo to reveal the link HUD, which looks like this:
When you first open the link HUD, New Rule will appear in the Rule section. Create your link by choosing options from the drop-down menus. All links have two parts: when something happens, something else happens.
The first "something happens", the trigger, can be chosen from a list. For frame-based links, this can be when the frame is shown or hidden, but it's more likely to be when the user's mouse interacts with the frame in some way: when the user clicks on the frame, or moves the mouse over it.
The second "something happens", the action, can also be chosen from a list. The list of possible actions to take varies depending on which trigger is chosen. Actions can be going to a page or hiding or showing a frame.
For some actions, a further parameter is required, the target of the link. This is not always the case - if you make a link that says "on mouse click" "go to next page", you don't need a target, because Sophie knows which page the next page is. But if you make a link that says "on mouse click" "go to page", Sophie doesn't know which page that is. A third field is opened up where you can choose which page to go to. If your action is to show or hide a frame, a list of all possible frames appears as a drop-down menu.
Possible frame actions are:
- Run script, which will run a script associated with the book. See the section of the documentation on scripting for information about how this works.
- Go to next page or Go to previous page, which go to the next or previous page.
- Go to page, which goes to any numbered page in the book; you'll need to enter the page number in the target field.
- Show frame, which shows a selected target frame if that frame is hidden.
- Hide frame, which hides a selected target frame if that frame is shown.
- Toggle frame, which hides a selected target frame if the frame is showing and shows the frame if it is hidden.
- Open URL, which will open a URL in a browser.
- Play/Pause/Stop/Rewind media, which will play, pause, stop, or rewind a selected media frame on the current page.
- Play/Pause/Stop/Rewind timeline, which will play, pause, stop, or rewind the current page's timeline.
Go to page, Go to next page, and Go to previous page can act on the current book or on any embedded book in it. You'll need to choose the book in which you want to the page turning to occur in from the drop-down menu; for Go to page a further drop-down menu will appear, listing all the pages in the book that can be turned to. If you want to change the names of pages, you can do that with the page structure palette.
The rule section, at the top of the link HUD, lets you choose between different links set on the same object. You can add a new link to the current object by choosing the New Rule from the drop-down menu; you can remove a saved link by clicking the - icon.
Links on a page
The page also has a link halo, which looks exactly like the frame's link HUD; clicking on it reveals the page's link HUD, which looks the same as the frame link HUD. The only different between the page link HUD and the frame link HUD is that the only two triggers that can be selected for page-based links are "when this page is opened" or "when this page is closed".
Links in text
You can create a text link by selecting text and clicking the text link halo to open the text link HUD. The text link halo is the link halo that appears above and to the right of the cursor position, not the link halo that appears in the frame's title bar - both a frame and text in it can have frames on them. Clicking the text link halo opens the text link HUD, which looks like this:
The text link differs from the page link HUD and the frame link HUD in that it has a bottom section, which allows you to set the color of the text link. Click on the color square to set the link color. Currently the link color appears as a background to the link text; in the future, this will be modified. If you click on the arrows to the right of the color section, you can set options for the normal, mouse-over, pressed, and visited states of the link: