开发者

Changing color of particular text in a text field

开发者 https://www.devze.com 2023-02-17 03:01 出处:网络
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

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

精彩评论

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

关注公众号