Recipe 7.12. Creating Text Hyperlinks


Problem

You want to add a hyperlink to static text.

Solution

Select the text to which you want to apply the hyperlink, and add the URL to the URL link field within the Property inspector.

Discussion

You can add a hyperlink to the text of a static text field by selecting the text and entering the URL into the URL link field in the Property inspector. You can apply the link to the entire text field by selecting it with the Selection tool, or you can apply the link to just a portion of the text by highlighting it with the Text tool.

Also, notice that there is a Target menu next to the URL link field. If you do not specify a target, the hyperlink opens up in the same browser window and frame as the Flash movie (assuming that the movie is playing in a browser.) Otherwise, you can enter a target frame/window into the Target menu or choose from the four options that are already entered for you:


_blank

Opens a new browser window.


_parent

Opens the link in the window that is the parent to the current window.


_self

Opens the link in the same window/frame. Choosing this option is the same as leaving the target value empty.


_top

Opens the link in the top frame within the same window in the event that the window contains multiple frames.

You can add hyperlinks only to horizontal, static text. You cannot add links to any vertical text, and you can add hyperlinks to dynamic text only using ActionScript.


Flash will recognize either absolute or relative URLs. For example, you can add a hyperlink such as http://www.person13.com/fcb/, which is an absolute URL, because it includes the domain as well as the logical path. You can also use a relative URL, such as /fcb/, in which the domain is assumed to be the same domain from which the SWF is being served. Be aware, however, that when you use an absolute URL you must provide the protocol portion. In other words, Flash can understand http://www.person13.com/fcb/, but it cannot correctly interpret www.person13.com/fcb/.If you fail to provide the protocol portion of the URL, Flash will interpret the URL as a relative hyperlink.

When the user hovers the mouse over hyperlinked text, the cursor icon changes to a hand instead of the normal arrow. This icon helps to signify that the text is clickable. However, Flash does not provide any other signs to the user that the text contains a hyperlink. Most web browsers interpret HTML hyperlinks by underlining them and changing the font to blue. This convention is understood by most web users, and so you may want to manually create this same effect. You can adjust the font color and underline the hyperlinked text so that the user can easily identify clickable text. See Recipe 8.12 for more information on how to change the text appearance of text in these ways.

Additionally, if you add a hyperlink to text and you later decide you want to remove that link, you can do so by selecting the text and deleting the value in the URL link field in the Property inspector.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net