开发者

Changing color of particular text in a text field

Consider I have the text

A quick brown fox jumps over the lazy dog.

Now, this text is in a dyn开发者_如何学Camic text field. I do not want to change the color of the whole field. just made fox red and dog blue.

How, can I do that in AS3. Have been looking around without no luck.

Thanks


When you use the method myTextField.setTextFormat() you can add arguments to it to specify what part of the String that it should apply to.

F.e.

myTextField.setTextFormat (myFormat, 5, 8);

will apply to characters 5-8.

So what you need to do is to make a new TextFormat with the color you want and setTextFormat() those characters.


You can use some HTML tags to format the text (or subset of it) inside your textField.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜