2

According to this webpage, the htmlText property in TextArea can handle CSS text style if using span tag. I want to format multiple tags in my code. Something like:

var tags:TextArea = new TextArea(); 
tags.htmlText = "<span style='color: rgb(165, 150, -90); 
  font-size: 0.955882610016677em'>street</span>,
  <span style='color: rgb(168, 143, -59); font-size: 0.98076913067067em'>
  motor</span>";

It only gives me plain text. I was wondering if it is supported in the htmlText property and how do I get around this. Any ideas? Thanks!

Amarghosh
  • 58,710
  • 11
  • 92
  • 121
saurb
  • 685
  • 1
  • 13
  • 24

2 Answers2

5

The htmlText supports only a limited set of tags and styles. Specifically, span supports only a class attribute which should be the name of a class specified in a StyleSheet object.

You can use the font tag in this particular case. But remember that color supports only hexadecimal #ffffff values and size supports only absolute pixel size and relative (+2, -1 etc) size values.

tags.htmlText = "<font color="#a89433" size="10">street</font>,
  <font color="#b37620" size="11">motor</font>";
Amarghosh
  • 58,710
  • 11
  • 92
  • 121
  • I was working on that problem for 5 hours and couldn't figure it out. Thank you SO MUCH! – saurb Oct 27 '09 at 06:34
0

http://github.com/theflashbum/fcss/

Not directly answering your question, but you should check out this project. CSS support in AS3 is awful, F*CSS mitigates some of that pain.

Joel Hooks
  • 6,465
  • 4
  • 33
  • 39