Question

I have a simple spark mxml check box and I want to change the background color via actionscript. I have searched and tried many suggestions, including using setStyle with 'background-color', 'chromeColor', symbolColor and others like this - the only thing that worked at all is chromeColor, which colored the box but not the text or background:

insUpdatedCB.setStyle('chromeColor','yellow');

I also tried using text format like this:

var myTf:TextFormat = new TextFormat();
myTf.size = 16; 
myTf.color = 0xFF0000; 
insUpdatedCB.setStyle("textFormat", myTf);  

also did not work

how can I set the label/text background color?

Was it helpful?

Solution

If you want to change the background color of the spark checkbox, then you have to apply a custom skin for it. Make a new Custom skin by making a copy of default checkboxSkin for spark checkbox, and then change the background color of the label in the Custom Skin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top