
TextFormat.url Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
906
|
ActionScript Language Reference
TextFormat.url Property
specifies a hypertext link
Flash 6
read/write
theFormat.url
Description
The string url property specifies a hypertext link for a span of text.
The TextFormat.url property has no effect unless TextField.html is set
to
true for the text field.
To load a document into a named window or frame, supply the window or frame name as
the value of
theFormat.target. Flash does not underline or color hypertext links; these
features must be inserted manually with the
underline and color properties. For informa-
tion on formulating links, see the global getURL() function and Appendix E.
To create a link for an entire text field, invoke TextField.setTextFormat() without speci-
fying any index arguments:
this.createTextField("theField_txt", 1, 0, 0, 250, 40);
theField_txt.border = true;
theField_txt.text = "Visit www.moock.org.";
theField_txt.html = true; // REQUIRED!!
// Create a TextFormat object
format = new TextFormat();
format.url = "http://www.moock.org/";
format.underline = true; // Add the underline manually
// Apply the hypertext link
theField_txt.setTextFormat(format);
To add a link to a single character, apply the format with a single index argument:
theField_txt.setTextFormat(0, format); // Link the first character, "V" ...