Copy link to clipboard
Copied
Hi
This might be a really simple question but I can't find the answer anywhere?!
How can I change the colour of the labels on checkboxes and radio buttons?
I tried this:
a1.setStyleProperty("textColor",0x990000);
but I get this error:
1061: Call to a possibly undefined method setStyleProperty through a reference with static type fl.controls:RadioButtonGroup.
can anyone help?
Thank you! : )
You should use TextFormat class to assign text formatting...
var newFormat:TextFormat = new TextFormat();
// whatever font styles you want to apply
newFormat.color = 0xFF0000;
a1.setStyle("textFormat", newFormat);
Copy link to clipboard
Copied
you wrote as2, try this one:
a1.setStyle("color",0x990000);
Copy link to clipboard
Copied
You should use TextFormat class to assign text formatting...
var newFormat:TextFormat = new TextFormat();
// whatever font styles you want to apply
newFormat.color = 0xFF0000;
a1.setStyle("textFormat", newFormat);
Copy link to clipboard
Copied
Many thanks - thats worked perfectly.
Is there a way to target all the checkboxes and radiobuttons rather than indvidually?
Thank you so much
Copy link to clipboard
Copied
You're welcome.
The only way I know of targeting all checkboxes is to use a loop. You could name them in a manner that allows you to use bracket notation to target them. For instance, if you were to name them... a1, a2, a3, etc....
for(var i:int=1; i<=numCheckboxes; i++){
this["a"+String(i)].setStyle("textFormat", newFormat);
}
Copy link to clipboard
Copied
Brilliant! - thanks once again!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now