Skip to main content
edwinmerced
Inspiring
July 25, 2010
Answered

Change color of text adio Component

  • July 25, 2010
  • 1 reply
  • 689 views

How can I change the color of the text of a radio button?

This topic has been closed for replies.
Correct answer kglad

Solved it kGlad. THANKS!!

Just a little code moving...

    arrChoices = new Array(arrAnswers[index].length);

    for (j=0; j<arrAnswers[index].length; j++) {
        arrChoices = new RadioButton();
       
        arrChoices.label = arrAnswers[index];
       
        arrChoices.value = j;
        arrChoices.width = qField.width;
        arrChoices.x = qField.x + 25;
        arrChoices.y = qField.y + qHeight + (aHeight+25)*j;
       
        arrChoices.group = rbg;
        qHolder.addChild(arrChoices);
            var tfor:TextFormat=new TextFormat();
        tfor.color=0xFFFFFF;
        arrChoices.setStyle("textFormat", tfor);
    }


great.

please mark this thread as answered, if you can.

1 reply

kglad
Community Expert
Community Expert
July 25, 2010

create a textformat instancer, assign its color and use:


var tfor:TextFormat=new TextFormat();

tfor.color=0xaa0000;

rb.setStyle("textFormat",tfor);  // where rb is your radio button reference.

edwinmerced
Inspiring
July 25, 2010

Helo KGlad:

Always do helpful,

I trie this but get i results...

arrChoices = new Array(arrAnswers[index].length);

    for (j=0; j<arrAnswers[index].length; j++) {
        arrChoices = new RadioButton();
        arrChoices.label.color = 0xFFFFFF;
        arrChoices.label = arrAnswers[index];
       var tfor:TextFormat=new TextFormat();
        tfor.color=0xFFFFFF;
        arrChoices.setStyle("textFormat", tfor);

        arrChoices.value = j;
        arrChoices.width = qField.width;
        arrChoices.x = qField.x + 25;
        arrChoices.y = qField.y + qHeight + (aHeight+25)*j;
       
        arrChoices.group = rbg;
        qHolder.addChild(arrChoices);
    }

edwinmerced
Inspiring
July 25, 2010

Solved it kGlad. THANKS!!

Just a little code moving...

    arrChoices = new Array(arrAnswers[index].length);

    for (j=0; j<arrAnswers[index].length; j++) {
        arrChoices = new RadioButton();
       
        arrChoices.label = arrAnswers[index];
       
        arrChoices.value = j;
        arrChoices.width = qField.width;
        arrChoices.x = qField.x + 25;
        arrChoices.y = qField.y + qHeight + (aHeight+25)*j;
       
        arrChoices.group = rbg;
        qHolder.addChild(arrChoices);
            var tfor:TextFormat=new TextFormat();
        tfor.color=0xFFFFFF;
        arrChoices.setStyle("textFormat", tfor);
    }