views:

3386

answers:

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!

A: 

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
It is not a direct answer but thank you for this. I'll check it out.
Jinru
+1  A: 

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
I was working on that problem for 5 hours and couldn't figure it out. Thank you SO MUCH!
Jinru