4 Replies Latest reply on Apr 20, 2011 6:13 AM by Sharkow

    Viewing simple text



      I'm stuck trying to view just a simple line of text in Flex 4.

      The only two things I need are the ability to set backgroundAlpha to my text box and to set the font (or maybe just the font size).

      I've found a lot of classes for viewing text but I don't see any suitable ones.

      Label doesn't have a backgroundAlpha, but the main problem is that it doesn't have a font or a fontSize property.

      In the documentation on spark:Label I've found a fontSize property. But I don't have it in my SDK! (the latest prerelease build).


      There is also a RichText class. It seems to have everything I need, but I can't make it work.

      private var rText:RichText = new RichText();
      var f:TextLayoutFormat = new TextLayoutFormat();
      f.backgroundAlpha = .4;
      f.backgroundColor = 0x222222;
      f.fontSize = 30;
      rText.textFlow.hostFormat = f;

      After this, for example, I get just a line of text without any visible container and with a default font size.


      What should I do? Thank you.