Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change title text color of a panel

Explorer ,
Jan 07, 2013 Jan 07, 2013

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

TOPICS
ActionScript
807
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 07, 2013 Jan 07, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 07, 2013 Jan 07, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 07, 2013 Jan 07, 2013

You should show the code thatyou tried that doesn't work for you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 07, 2013 Jan 07, 2013

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:

PanelTitle.png

Regards

Mathangi

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 07, 2013 Jan 07, 2013
LATEST

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>";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines