TextFormat.url Property | Flash 6 | specifies a hypertext link | read/write | 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 information on formulating links, see the global getURL( ) function and Appendix E. To create a link for an entire text field, invoke TextField.setTextFormat( ) without specifying 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" To add a link to a range of characters, apply the format with start and end index arguments: // Link the text: "www.moock.org" theField_txt.setTextFormat(6, theField_txt.length, format); The default url value (as contained in the TextFormat object returned by TextField.getTextFormat( )) for a text field that contains text is an empty string (no link). For a text field without any text, the url value is null. For a completely new TextFormat object, it is also null, indicating that url will not be set when the format is applied to a text field: trace(anyUnformattedField_txt.getTextFormat().url); // Displays nothing var format = new TextFormat(); trace(format.size); // Displays: "null" See Also getURL( ), TextField.html, TextFormat.color, TextFormat.target, TextFormat.underline; Appendix E |