Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting dynamic text colors 1

Status
Not open for further replies.

kentara

Programmer
Apr 13, 2005
38
US
Okay, I thought this would be easier, but I must be missing something. I have a dynamic text box with an instance name of "messagebox". I want to change the color of the text in this box. However, my code isn't working.

Here is my code:

Code:
textCol = new TextFormat();
textCol.color = 0xFFCC00;
textCol.underline = true;
messagebox.setTextFormat(textCol);

Any ideas? Am I missing something obvious?

Thanks,
kentara
 
I solved this by using this.createTextField to create the text box instead of drawing a text box on the stage.

i.e., by adding this before the rest of the code:
Code:
this.createTextField ("messagebox", 0, 163, 534, 247, 18);

Isn't there any way to specify style property changes to text boxes that are drawn on the stage?

kentara
 
Either set the properties in the textfield property inspector to start with...

Or...

myText.text = "Oldnewbie";
myText.textColor = 0xFF0000;

Or html tags...

myText.html = true;
myText.htmlText = "<font color='#00cc00' face='Arial'>Here is a link to <font color='#00ccff'><u><a href=' my website</a></u></font></font>";




Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top