The url property allows you to add a hyperlink to text. : text « TextField « Flash / Flex / ActionScript






The url property allows you to add a hyperlink to text.

 


package{
  import flash.display.Sprite;
  import flash.text.*;  
  public class Main extends Sprite{
    public function Main(){

        var tContent:TextField = new TextField();
        tContent.multiline = true;
        
        tContent.border = true;
        tContent.wordWrap = true;
        tContent.text = "Visit the Web site";

        var tfFormatter:TextFormat = new TextFormat();
        tfFormatter.url = "http://thefactoryfactoryfactory.com/wordpress";
        tfFormatter.target = "_blank";
        tfFormatter.underline = true;
        tContent.setTextFormat(tfFormatter,2,5);
        addChild(tContent);
    }
  }
}

        








Related examples in the same category

1.Displaying Text
2.Retrieving Strings from a TextField
3.Special characters, such as \t for tab and \n for newline, can be used within a text string.
4.You can append text by using the += operator or the appendText( ) method
5.Append text to TextField
6.Replaces the characters "bcd" in the text "abcde" with the new text "x"
7.If beginIndex and endIndex are equal, the newText is inserted immediately before the specified beginIndex
8.The getLineIndexOfChar()/getLineLength()