EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 438

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
438 Working with Text and Strings
Anchor tag
The <a> tag creates a hypertext link and supports the following attributes:
href A string of up to 128 characters that specifies the URL of the page to load in the
browser. The URL can be either absolute or relative to the location of the SWF file that is
loading the page. An example of an absolute reference to a URL is
http://
www.macromedia.com
; an example of a relative reference is /index.html.
target Specifies the name of the target window where you load the page. Options
include
_self, _blank, _parent, and _top. The _self option specifies the current frame
in the current window,
_blank specifies a new window, _parent specifies the parent of
the current frame, and
_top specifies the top-level frame in the current window.
For example, the following HTML code creates the link “Go home,” which opens
www.macromedia.com in a new browser window:
urlText_txt.htmlText = "<a href='http://www.macromedia.com'
target='_blank'>Go home</a>";
You can use the special asfunction protocol to cause the link to execute an ActionScript
function in a SWF file instead of opening a URL. For more information on the
asfunction
protocol, see asfunction protocol in the ActionScript 2.0 Language Reference.
You can also define
a:link, a:hover, and a:active styles for anchor tags by using style
sheets. See “Styling built-in HTML tags on page 430.
Bold tag
The <b> tag renders text as bold, as shown in the following example:
text3_txt.htmlText = "He was <b>ready</b> to leave!";
A bold typeface must be available for the font used to display the text.
Break tag
The <br> tag creates a line break in the text field. You must set the text field to be a multiline
text field to use this tag.
In the following example, the line breaks between sentences:
this.createTextField("text1_txt", 1, 10, 10, 200, 100);
text1_txt.html = true;
text1_txt.multiline = true;
text1_txt.htmlText = "The boy put on his coat.<br />His coat was <font
color='#FF0033'>red</font> plaid.";
NOTE
Absolute URLs must be prefixed with http://; otherwise, Flash treats them as relative
URLs.

Table of Contents

Related product manuals