Copy link to clipboard
Copied
Hello
I am having a scenario wherein I have to color change only a part of my text in my panel title.
Example:
Title.text = "Report filters Report name";
where 'Report filters' should be color black
'Report name' should be in orange.
Can someone help me in achieveing this. Thanks!
Regards
Mathangi
Copy link to clipboard
Copied
You can try assigning the text using the htmlText property and use html tags to color the text. You could also probably set the text format for sections of the text based on selection sections, though that could be more challenging for you than using the htmlText approach.
Copy link to clipboard
Copied
Hello Ned
As I havent worked on htmlText earlier, though I tried with some sample codes, I am getting error. Will it possible to share with me an example.
Otherwise, I tried defining the report name as Text (txt1), and used setStyle property to define the orange color. When I added the txt1 to the panel as a child component, I am getting the color, whereas the same displayed as panel.title text, the color is not considered. So I feel, its like setting on panel title is not working correctly.
Regards
Mathangi
Copy link to clipboard
Copied
You should show the code thatyou tried that doesn't work for you.
Copy link to clipboard
Copied
Below is the code:
var rptfilter:String = "Report Filters";
var rptn:Text = new Text();
// To get red color
var urlLinkColor:String = "CC4477";
var myTextVar:String = lblsl + "<font color=\u0022#" + urlLinkColor +"\u0022>" + "</font>";
rptn.htmlText = myTextVar;
var rptn1:String = rpt + " " + rptn;
// Setting Panel title to get like 'Report Filter Report Name'"
temp1.panel1.title = rptn1;
When I run my .mxml, I get my Panel Title like this:
Regards
Mathangi
Copy link to clipboard
Copied
Maybe I am missing something as far as understanding the types of objects you are using. What is the Text class? What is temp1.panel.title (and the parent elements of it, temp1 and panel)?
As far as the htmlText line goes, you are not displaying any text in it = something needs to be where the ???? are shown...
var myTextVar:String = lblsl + "<font color=\u0022#" + urlLinkColor +"\u0022>" + ????+ "</font>";
Find more inspiration, events, and resources on the new Adobe Community
Explore Now