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.";
NO
TE
Absolute URLs must be prefixed with
http://
; otherwise, Flash treats them as relative
URLs.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...