Example of a different font color for a text rendering in Flex

Source: Internet
Author: User
Tags xmlns
This article for you in detail how to achieve the next flex in a text rendering different font color, the specific implementation of ideas and code as follows, interested friends can refer to ha, I hope to help you

Beginning to confine the control to the label, it seems unrealistic to realize that. You should use the TEXTAREA control:

Copy Code code as follows:


<?xml version= "1.0" encoding= "Utf-8"?>
<s:application xmlns:fx= "http://ns.adobe.com/mxml/2009"
xmlns:s= "Library://ns.adobe.com/flex/spark"
xmlns:mx= "library://ns.adobe.com/flex/mx" minWidth= "955" minheight= "creationcomplete=" inital (); >
<fx:Script>
<![ cdata[
Import Flashx.textLayout.conversion.TextConverter;
Public Function inital (): void{
var str:string = "<font color= ' #ff0000 ' >123456<font color= ' #32CD32 ' >shit</font></font> ";
Txt.textflow = Textconverter.importtoflow (str, textconverter.text_field_html_format);
//txtarea.text = "I am Chinese, I am Chinese, I am Chinese";
}
]]>
</fx:Script>
<mx:canvas x= "y=" width= "$" > "height="
<s:text Area id= "TXT" >
</s:TextArea>
</mx:Canvas>
</s:application>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.