1 Reply Latest reply on Jan 9, 2007 4:10 PM by kglad

    how do you get a TextField.htmlText to display a < character?

    betawaves
      I'm trying to have a dynamic text field display htmlText and I've run into a bug/problem where the text field will NOT display the < character (less than sign). In fact, unless I escape that character like: \<, the text field stops displaying ANYTHING after a < as well.

      var tff:TextFormat = new TextFormat();
      tff.size = 12;
      tff.color = 0x000000;
      tff.align = "left";
      mytextField.ptf.type = "dynamic";
      mytextField.ptf.multiline = true;
      mytextField.ptf.html = true;
      mytextField.ptf.embedFonts = false;
      mytextField.ptf.selectable = false;
      mytextField.ptf.autoSize = "left";
      mytextField.ptf.htmlText = myHTMLString;
      mytextField.ptf.setTextFormat(tff);

      mytextField is a clip on the stage that has a dynamic text field in it. it's set to Arial and Use Device Fonts.
      the results when
      var myHTMLString:String = "<i>this</i> is a <b>sample piece</b> of html text with a \< character."
      displays:
      this is a sample piece of html text with a \ character.
      and when
      var myHTMLString:String = "<i>this</i> is a <b>sample piece</b> of html text with a < character."
      displays:
      this is a sample piece of html text with a

      I presume that it's having problems displaying the < character because it's confusing it with the start of an html tag.
      How do you escape the < character so it can be displayed?
      I tried url and html encoding it (&lt; and %3C) but got the same results