Link to home
Start Free TrialLog in
Avatar of stalbergpar
stalbergparFlag for Sweden

asked on

Two different colors and fonts in the same textarea

Hi,

Im trying to print out an dynamic text that I have combined from two var.
Example:

var text1 = "text number 1";
var text2 = "text number 2";

var combined = text1 + text2;

t.icon.testText.text = combined;

Now I want to set text1 to have one font size and color and text2 another.

Is it possible to do something like var combined = text1 + "<span style='color:#cccccc'> " + text2 +"</span>";
I don't thinks

The whole thing is going into a textarea that I don't at the moment put in by code. But i would like that but when I tried it did not work and the text was distorted when I was animating it.

Avatar of Bradley Haynes
Bradley Haynes
Flag of United States of America image

All the direction you may need to modify text in Macromedia:
http://www.adobe.com/devnet/dreamweaver/articles/css_forms.html
Avatar of stalbergpar

ASKER

Hmm Sorry But this is a Adobe Flash problem...
Avatar of Kiran Paul VJ
try this

on you textarea properties panel, select parameters, select html as true

now try something like this

text1.text = "<font color='#FF0000'>This is red text</font><font color='#0000FF'> This is blue text</font>";

where text1 is the instanse name of your textarea,. I have check it in Flash 8, dont know the case of CS3

kiranvj
ASKER CERTIFIED SOLUTION
Avatar of Kiran Paul VJ
Kiran Paul VJ
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yep the last one did not work but I found the problem.
need to set the test output to the var to htmlText insted of just .text
Solution here:

var text1 = "text number 1";
var text2 = "text number 2";

var combined = "<font color='#FF0000'>"+text1 +"</font><font color='#0000FF'>"+ text2 +"</font>";

t.icon.testText.html = true;
t.icon.testText.htmlText = combined;
t.icon.testText.text worked fine for me in Flash 8

but first I checked with htmlText (which i saw in website). but somehow it did not work in Flash 8, I dont have cs3 on my machine, so i could not check. Anyway glad to know its fixed :)

kiranvj