View Full Version : change colour of Dyamic Text Field
CharlieCharles
02-10-2009, 05:38 PM
Hi
Could someone help me please?
I using a dynamic text field font colour set to back but, I would like one of the words in the sentence to be red
text_txt.text = "This word RED";
Could someone tell me how would I do this?
Thank you for your help
Kind Regards
Charles
rawmantick
02-11-2009, 06:27 AM
Look at TextField (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html)'s setTextFormat() (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html#setTextFormat()) method's second and third arguments. This will totally answer your question.
Hope it helps.
Anil_kumar
02-11-2009, 06:46 AM
Try this code
//AS3
var newFormat:TextFormat = new TextFormat();
newFormat.size=20;
newFormat.bold=true;
newFormat.color=0xFF0000;
newFormat.align = TextFormatAlign.LEFT;
var MyTextField = new TextField();
MyTextField.text = "This word RED";
MyTextField.width=200;
MyTextField.selectable = false;
MyTextField.setTextFormat(newFormat);
addChild(MyTextField);
Anil
Flash Workshop (http://flash-workshop.blogspot.com/)
anilkumarnd@gmail.com
Hi
Could someone help me please?
I using a dynamic text field font colour set to back but, I would like one of the words in the sentence to be red
text_txt.text = "This word RED";
Could someone tell me how would I do this?
Thank you for your help
Kind Regards
Charles
Hi,
import flash.text.TextField;
var text_txt:TextField = new TextField();
text_txt.htmlText = "This word is "+<FONT FACE="Times New Roman" SIZE="15" COLOR="#FF0000" LETTERSPACING="10"><b>RED</b></FONT>;
text_txt.autoSize = TextFieldAutoSize.LEFT;
stage.addChild(text_txt);
CharlieCharles
02-11-2009, 09:30 AM
Hi
Thank you for all great help, that worked Great!
Kind Regards
Charles
CharlieCharles
02-11-2009, 10:27 AM
Just let any reading this post to make single line do
text_txt.htmlText = "hello <FONT FACE=\"verdana\" SIZE=\"18\" COLOR=\"#FF0000\"><b>RED</b></FONT>";
CharlieCharles
02-11-2009, 10:28 AM
Just let any reading this post to make single line do
text_txt.htmlText = "hello <FONT FACE=\"verdana\" SIZE=\"18\" COLOR=\"#FF0000\"><b>RED</b></FONT>";
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.